Cheatsheets
Vim
Vim motions, editing, search/replace, and file commands.
Visualize
Vim — modal editing
Keys mean different things per mode; Esc always returns to Normal.
Normal: Navigate & run commands — keys are actions (dd, yy, p, hjkl).
Keys mean different things per mode — and Esc always returns you to Normal.
40 entries
The operator+motion grammar (verb + noun)2
<operator><motion>Vim is a language: combine an operator (verb) with a motion or text object (noun).
[count]<operator><motion>Prefix any command with a count to repeat it that many times.
Text objects3
i / a (inner vs around)Text objects select structured regions. `i` = inner (content only); `a` = around (includes delimiters/whitespace).
iw / aw / iW / aWInner word / around word / inner WORD / around WORD
i( i[ i{ i< i" i' i` / it is ipInner pair / tag / sentence / paragraph text objects
Motions9
h j k lLeft, down, up, right
w / b / eNext / previous / end of word
0 / ^ / $Line start / first non-blank / end
gg / GTop / bottom of file
{ / }Previous / next paragraph
Ctrl-d / Ctrl-uHalf page down / up
:<n> or <n>GJump to line n
%Jump to matching bracket
f<char> / t<char>Jump to / before next char on line
Editing9
i / a / AInsert before / after cursor / end of line
o / OOpen line below / above
dd / yy / pDelete / yank line, paste
cw / ciwChange word / inner word
ci" / di(Change inside quotes / delete inside parens
x / r<char>Delete char / replace char
u / Ctrl-rUndo / redo
>> / <<Indent / dedent line
.Repeat the last change
Search & replace6
/patternSearch forward for pattern (regex)
n / NNext / previous match
* / #Search word under cursor fwd / back
:%s/old/new/gcReplace all occurrences in the file, confirming each
:%s/old/new/gReplace all in the file
:g/pattern/dDelete all lines matching pattern
Visual modes5
v / V / Ctrl-vChar-wise / line-wise / block visual mode
gvReselect the last visual selection
"ayy / "apYank to / paste from register a
ma / `aSet mark a / jump to exact position of mark a
qa ... q / @aRecord macro into register a / replay macro a
Files, windows & buffers5
:w :q :wq :q!Save / quit / save+quit / force-quit
:e fileOpen a file
:sp / :vspHorizontal / vertical split
Ctrl-w h/j/k/lMove between splits
:bn / :bp / :lsNext / prev buffer / list buffers
Jumps & the jump list1
Ctrl-o / Ctrl-iJump back / forward through the jump list