← all cheat sheets

vi cheat sheet

Two 10 × 11 cm cards — modal editing (vi / Vim) for either side of a 15″ MacBook trackpad.

Print & cut
  1. Print on A4, landscape. In the print dialog set Scale = 100% (not “Fit to page”) and turn Margins → None/Default — this keeps the cards at exactly 10 × 11 cm.
  2. Cut along the dashed borders.
  3. Slide card 1 under the keyboard on the left of the trackpad, card 2 on the right.

vi is modal. Most keys act in Normal mode — press i/a to Insert, Esc to return. Lines starting with : are the command line. Prefix a number to repeat (3dd = delete 3 lines). = Ctrl. Vim-flavored (works in modern vi).

Preview below is shown enlarged; it prints at real size (10 × 11 cm each).

vi 1

Esc → Normal

Insert

i/ainsert / append I/Aline start / end o/Oopen below / above Rreplace mode

Modes

Escback to Normal v/Vvisual / line vvisual block :command line

Move

hjkl← ↓ ↑ → w/bword fwd / back eend of word 0/$line start / end ^first non-blank gg/Gfirst / last line :ngo to line n

Jump

d/uhalf-page ↓ / ↑ {/}paragraph ↑ / ↓ %match bracket f/tcfind / till char ;/,repeat find
matuta.art/cheatsheets◀ left of trackpad

vi 2

Esc → Normal

Edit

xdelete char dddelete line dw/d$del word / to end cc/cwchange line / word C/Dchange / del to end rcreplace one char Jjoin lines .repeat last change

Undo

uundo rredo >>/<<indent / outdent

Copy & paste

yyyank (copy) line ywyank word p/Ppaste after / before

Search

//?search fwd / back n/Nnext / prev match *word under cursor :%s/a/b/greplace all

Files

:wsave (write) :qquit :wqsave & quit · ZZ :q!quit, no save :e fileopen file
matuta.art/cheatsheetsright of trackpad ▶