To get you started off with some great-to-know commands for Vim, we've incorporated a cheat sheet. After working through vimtutor, having this cheat sheet nearby almost guarantees you can properly use Vim!
Keystrokes are entered directly. Note that the keystrokes are case sensitive, so a is different from A. You can either hold Shift for the capital letters or use the Caps Lock key. However, the most practical approach would be to use Shift:
|
Keystroke |
Effect |
|
Esc |
Exit insert mode, go back to command mode. |
|
i |
Enter insert mode before the current location of the cursor. |
|
a |
Enter insert mode after the current location of the cursor. |
|
I |
Enter insert mode at the beginning of the current line. |
|
A |
Enter insert mode at the end of the current line. |
|
o |
Enter insert mode with a new line below the current line. |
|
O |
Enter insert mode with a new line above the current line. |
|
dd |
Delete the current line. |
|
u |
Undo the changes made in the previous insert mode. |
|
Ctrl + r |
Redo an undo. |
|
yy |
'Yank' the current line (=copy). |
|
p |
Paste the last yanked line below the current line. |
|
P |
Paste the last yanked line above the current line. |
|
H |
Navigate to the beginning of the file. |
|
M |
Navigate to the middle of the file. |
|
G |
Navigate to the end of the file. |
|
dH |
Delete all lines until the beginning of the file (including the current line). |
|
dG |
Delete all lines until the end of the file (including the current line). |