VIM Cheatsheet
vim {file} — Vi IMproved, a programmers text editor
Commands
i – insert mode
esc – get out of insert mode
:{number} – go to that line number
:q – quit
:q! – force quit (no save)
:e! – discard edits to last saved state
:w – save document (write)
:wq – save and quit document
:ZZ – save and quit document
Moving Around
h, j, k, l — move cursor like arrow keys
$ – move cursor to end of current line
0 – move cursor to start of current line
w – move to next word
b – go back a word
ctrl f – page down
ctrl b – page up
Copy and Paste
y – yank or copy
yw – copy word
yy – copy whole line
#y – copy # of words. Example 5y (copy 5 words)
#yy – copy # of lines. Example 5yy (copy 5 lines)
p – paste
Undo and Delete
u – undo
x – delete current letter
dd – delete whole line
dw – delete next word
db – delete previous word
cw – delete next word and go into insert mode
cc – delete line and go into insert mode
Visual Mode
v – activate visual mode
Additional Shortcuts
shift i – go to start of curent line start insert mode
shift a – go to end of current line start insert mode
d arrowletter – delete word direction you point