Vim operates in three primary modes: Command Mode (default), Insert Mode, and Visual Mode.

Mode switching

  • a, I, A: Enter Insert Mode (after cursor, line beginning, line end)
  • v, V, Ctrl-V: Enter Visual Mode (character, line, block-oriented)

Essential Command Mode operations

KeyAction
hMove left
lMove right
jMove down
kMove up
wNext word
eEnd of word
bBeginning of word

Deletion

KeyAction
ddDelete line
3ddDelete 3 lines
dwDelete word
dbDelete previous word
DDelete from cursor to end of line
xDelete character

Editing

KeyAction
rReplace character
yyCopy line
3yyCopy 3 lines
pPaste
uUndo
.Repeat last command
KeyAction
/Search forward
?Search backward
nNext match
NPrevious match