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#
Navigation#
| Key | Action |
|---|
h | Move left |
l | Move right |
j | Move down |
k | Move up |
w | Next word |
e | End of word |
b | Beginning of word |
Deletion#
| Key | Action |
|---|
dd | Delete line |
3dd | Delete 3 lines |
dw | Delete word |
db | Delete previous word |
D | Delete from cursor to end of line |
x | Delete character |
Editing#
| Key | Action |
|---|
r | Replace character |
yy | Copy line |
3yy | Copy 3 lines |
p | Paste |
u | Undo |
. | Repeat last command |
Search#
| Key | Action |
|---|
/ | Search forward |
? | Search backward |
n | Next match |
N | Previous match |