Vim Cheat Sheet

Operator/CommandFunction
d Delete operator
c Change operator
y Yank (Copy) operator
"*y Yank operator to clipboard
p Put register after cursor
P Put register before cursor
"*p Put clipboard after cursor
r Replace one character
. Repeat a change
n Repeat a pattern
N Repeat a pattern backwards
d (vis)Delete selection (in visual mode)
y (vis)Yank selection (in visual mode)
o (vis)Move to other side of selection (in visual mode)
ModeFunction
i Enter Insert-mode at current position
I Enter Insert-mode at the start of the line
A Enter Insert-mode at the end of the line (Append)
o Enter Insert-mode at a new line beneath cursor
O Enter Insert-mode at a new line above cursor
v Enter Visual mode
V Enter Visual Line mode
CTRL-V Enter Visual Block mode
R Enter Replace mode
MovementFunction
w Next word
e Last character of next word
2w Next two words
b Previous word (back)
ge Last character of previous word
G Last line of file
gg Beginning of file
NNG Go to line number NN
$ End of line
f Find a character
F Find a character backwards
% Find a matching {},(),[]
NxM ExamplesFunction
c$ / C Change until end of line
cl / s Change one character
cc / S Change the whole line
cf Change until Find command
dw Delete word
d2w Delete two words
dd Delete a whole line
dl / x Delete character under cursor
dh / X Delete character left of cursor
d$ / D Delete until end of line
df Delete until Find command
yw Yank word
y2w Yank two words
yy / Y Yank a whole line
y$ Yank until end of line
Text ObjectFunction
aw A word
as A sentence
ap A paragraph
a[ / a]A [] block
a( / a)A () block
a> / a<A <> block
at A tag ("<tag></tag>")
a{ / a}A {} block
a" / a'A quoted string
Fold CommandFunction
zfap Fold a paragraph
zf% Fold with % movement
zfNNG Fold to line NN
zm Fold more (one level)
zr Fold reduce (one level)
zM Fold More and More (all levels)
zR Fold Reduce and Reduce (all levels)
zn Disable folds temporarily
zN Re-enable folds
zi Toggle enable/disable
zo Open fold at cursor
zc Close fold at cursor
zO Open all folds at cursor
zC Close all folds at cursor
zj Move to the start of the next fold
zk Move to the end of the previous fold
:mkviewSave all manual folds
:mkloadRestore manual folds
:folddoExecute a command on folds
Fold FlagFunction
set foldmethod=indentAutomatically folds by indentation ('shiftwidth').
set foldmethod=syntaxFolds as defined by the syntax item
set foldmethod=markerFolds by markers in the text
set foldmethod=exprFolds by the expression defined in foldexpr
set foldlevel=XGo to a specific fold level (zm and zr increase/reduce)