Vim
01 / 02

Modes, Movement & the Verb+Motion Grammar

Modes, Movement & the Verb+Motion Grammar

Modal Editing

The same keys do different things depending on the active mode. Normal mode (the default) is for navigation/commands — letters trigger actions, not literal typing. Insert mode (i, a to enter) types text conventionally. Escape returns to Normal. Visual mode (v/V/Ctrl+V) selects a range for a following command.

Movement

h j k l     left/down/up/right — stay on the home row
w / b       next word / previous word
0 / $       start / end of line
gg / G      top / bottom of file
/pattern    search forward, n/N repeat forward/backward
5j          move down 5 lines — counts prefix and repeat any motion

Verb + Motion/Text Object Grammar

dw    delete to next word         d$    delete to end of line
cw    change word                 ciw   change inner word
di"   delete inside quotes        ci(   change inside parens
yy    yank (copy) the line        3dd   delete 3 lines
p     paste after cursor

A small set of verbs (d/c/y) combined with motions (w/$/gg) or semantic text objects (iw, i", i() combine into a huge number of precise commands — this composability, not memorizing shortcuts individually, is Vim's core design idea.

Command-Line Mode: Save & Quit

:w       write (save)
:q       quit (refuses if unsaved changes exist)
:wq  or :x   write then quit
:q!      force-quit, discard changes
:%s/old/new/g   substitute every match, whole file

Keep your own version of these notes — editable, searchable, and organised by your stack.

Start free