Vi

Vi

j
Moves cursor down one line (same as down arrow)
k
Moves cursor up line (same as up arrow)
l
Moves cursor to the right one character (same as right arrow)
h
Moves cursor to the left one character (same as left arrow)
w
Moves cursor to beginning of next word
e
Moves cursor to end of word
b
Moves cursor to beginning of previous word
$
Moves cursor to end of current line (same as End key)
0 (zero)
Moves cursor beginning of current line (same as Home key)
3G
Jumps to third line (nG jumps to the nth line)
1G
Jumps to first line
Shift+G
Jumps to the last line
dw
delete word
2dw
delete two words
u
undo
4u
undo last four actions
14x
delete 14 characters
dd
delete current line
P
Paste
yw
Copy current word
i
Enter insert mode
Esc
Exit insert mode
:x
Will save and close the file.
:wq
Will write to file and quit.
:wq!
Will write to a read-only file, if possible, and quit.
ZZ
Will save and close. Notice that no colon : is used in this case.
:q!
Exit without saving changes
:e!
Discard changes and reload file
:w!
Write to read-only, if possible.