Tools

Vim

Modal editing — motions, operators, and commands.

Modes

i / aInsert before / after cursor
I / AInsert at line start / end
o / OOpen line below / above
v / VVisual / visual-line
Ctrl-vVisual block
EscBack to normal mode

Motions

w / bNext / prev word
0 / $Line start / end
gg / GFile start / end
{ / }Prev / next paragraph
%Matching bracket
f<c> / t<c>Find / till char

Editing

dd / yyDelete / yank line
dw / cwDelete / change word
x / r<c>Delete / replace char
p / PPaste after / before
u / Ctrl-rUndo / redo
. Repeat last change

Search & replace

/patternSearch forward
n / NNext / prev match
*Search word under cursor
:%s/a/b/gReplace all in file
:%s/a/b/gcReplace with confirm

Files & windows

:wSave
:q / :q!Quit / force quit
:wq / ZZSave and quit
:sp / :vspSplit horizontal / vertical
Ctrl-w wCycle windows

Operators + motions

diwDelete inner word
ci"Change inside quotes
yi(Yank inside parens
dapDelete a paragraph
d3jDelete 3 lines down

Combine an operator (d, c, y) with a motion or text object.