// REF. 01 / MODAL EDITING

Vim cheat sheet

The Vim commands you’ll actually use, grouped the way you think about them. Vim is modal: you start in normal mode, where keys are commands. Press i to type text and Esc to get back. Most edits are a verb plus a motion, so d (delete) + w (word) = dw, and c + iw changes the word under the cursor.

Every command on this page is printed on our Vim Field Manual desk mat.

↓ Download the printable PDF free · letter size · no email needed

Motion

h j k l
left · down · up · right
w / b
next / previous word
e
end of word
0 / $
start / end of line
^
first non-blank
gg / G
top / bottom of file
{ / }
previous / next paragraph
%
matching bracket
f x / t x
find / till char x
Ctrl-d / Ctrl-u
half page down / up

Insert

i / a
insert before / after cursor
I / A
insert at line start / end
o / O
open line below / above
Esc
back to normal mode

Edit

x
delete char
dd
delete line
dw
delete word
cw
change word
cc
change line
yy
yank (copy) line
p / P
put after / before
u / Ctrl-r
undo / redo
.
repeat last change
>> / <<
indent / outdent

Text objects

ciw
change inner word
di(
delete inside parens
ya"
yank around quotes
dap
delete a paragraph
vit
select inside tag

Search & replace

/text
search forward
?text
search backward
n / N
next / previous match
* / #
word under cursor
:%s/a/b/g
replace all a with b
:%s/a/b/gc
replace, confirm each

Visual

v
select characters
V
select lines
Ctrl-v
select block
o
jump to other end
gv
reselect last

Files & windows

:w
write
:q / :q!
quit / quit, discard
:wq / ZZ
write and quit
:e file
edit file
:sp / :vsp
split / vertical split
Ctrl-w h j k l
move between splits
:bn / :bp
next / previous buffer

Macros & marks

qa … q
record macro into a
@a / @@
play a / replay last
ma
set mark a
'a / `a
jump to line / spot of a
Vim Field Manual Desk Mat

// KEEP IT UNDER YOUR KEYBOARD

Vim Field Manual Desk Mat

from $34 · printed to order in the USA

See the desk mat