Info
CTRL + g
display file name and location info
CTRL + q
Exit from scroll lock (freeze)
CTRL + s
Lock and unlock (scroll freeze)
Undo
u
undo
U
undo all changes on a line
CTRL + r
redo
Delete
dw
delete a word
dd
delete a whole line
d$
delete a whole line after cursor
p
paste (deleted text)
cw
delete a word and insert
c$
change to the end of line and insert
Search
/
search forward
?
search backward
n
search next occurrence
N
search in opposite direction
%
to locate matching pair eg. () {} []
:%s/old/new/gc
search and replace old with new
Run command
:!
to run commands
:w
filename.txt write current to disk
:#,#w
filename.txt write # through # to disk
:r
filename.txt insert to existing file
Working with multiple files
:ls
list of current buffers
:b
old.txt buffer back to open file
:badd
read.txt open file (add to buffer)
:e
new.txt open new file
Moving
w
word forward
W
WORDS forward
b
word backward
B
WORDS backward
e
or E
end of word
Ctrl + H
high top screen
Ctrl + M
medium screen
Ctrl + L
bottom of screen
gg
top
G
bottom
Switch window
Ctrl + W + s
split horizontal
Ctrl + W + v
split vertical
Ctrl + W + h j k l
(move windows)
Insert smarter
I
insert at the beginning of line
A
insert at the end of line
o
insert below the cursor
O
insert above the cursor
C
delete all text to the end of line (enters insert mode)
D
delete all text to the end of line only
J
join (removes spacing)
Help
:help
word-motions