h | left |
j | down |
k | up |
l | left |
gg | go to top |
G | go to bottom |
w | next word |
b | back a word |
: + number | go to line number |
0 | Move to beginning of line |
$ | Move to end of line |
zz | Center cursor |
zt | Put cursor at the top |
< | Remove indent |
> | Indent |
g + j | Move down one line without the line break |
g + k | Move up one line without the line break |
g + 0 | Beginning of line without the line break |
g + $ | End of line without the line break |
e | Move to the end of a word |
:w | save |
:q | quit |
:wq | save and quit |
:wq! | force a save and quit |
ctrl + v | select lines |
shift + i | comment |
esc |
ctrl + v | select lines |
ctrl + v then shift + I | Insert in front of the lines you selected. |
select numbers then ctrl + a | increment number by 1 |
select numbers then ctrl + x | decrement number by 1 |
select numbers then g then ctrl + a | progressively increment. 1 2 3 4 etc. |
select number then g then ctrl + x | progressively decrement. 4 3 2 1 etc. |
select then shift + u | Uppercase |
select then u | Lowercase |
i | insert mode |
o | insert line below and i mode |
O | insert line above and i mode |
a | insert to the right |
esc | back to command/normal mode |
v | visual mode |
dd | delete line and copy line to default register |
x | delete where your cursor is at |
c | change |
c + i + w | change in word |
r | replace letter |
u | undo |
ctrl + r | redo |
. | redo command again |
yy | copy line to default register |
p | paste below default register |
P | paste above default register |
” + char + y | copy to char register |
” + char + p | paste from char register |
” + + | clipboard register |
/ + regex + enter | Search forward on page |
? + regex + enter | Search backward on page |
n | got to next |
N | go back one |
:noh | remove highlight |
:let @/=’’ | remove the current search |
:s/regex/replace | search and replace. You can also do this for selected text. |
f + character | Go to the next occurrence of that character in the current line. |
shift + f + character | Go to the previous occurrence of that character in the current line. |
s/\(.\)$/\1 add to end of lines/g | Add something to the end of selected lines |
s/\(^.*$\)$/Begin \1 End/g | Add something to beginning and end of selected lines |
\r |
New line |
\u |
Uppercase the following character |
q + macro + keys + q | record keys and put it in macro |
@ + macro | play macro |
(O)pen | Read only mode |
(E)dit | The last save |
(R)ecover | Read in all data. Need to delete .swp file after. Use when .swp file contains changes you know you want to restore. |
(Q)uit | Quits the 1st command for vim. Same as abort if only opening 1 file |
(A)bort | Go back to terminal |