Vim Commands Reference

Every essential Vim command with its mode context (normal / insert / visual / command), variations with counts, real examples, and the mode-confusion gotcha that traps everyone. Vim 8+ default bindings.

Navigation

Editing

i / a / o / O
The four ways to enter insert mode: i inserts BEFORE the cursor, a inserts AFTER it, o opens a new line BELOW and enters insert mode, O opens a new line ABOVE. Choosing the right one saves a motion or two before you start typing.
dd
Deletes the current line (and stores it in the unnamed register, so you can paste it back with p). The bread-and-butter 'get rid of this line' command.
yy
'Yank' (copy) the current line into the unnamed register — Vim's word for copy. Combine with p/P to duplicate lines without touching your system clipboard.
p / P
Paste the contents of the unnamed register: p pastes AFTER the cursor (or below the line, for a linewise yank), P pastes BEFORE the cursor (or above the line). Works with anything you dd'd, yy'd, or x'd.
u / Ctrl-R
u undoes the last change; Ctrl-R redoes it. Vim has a full undo TREE (see :undolist and g-/g+) but for day-to-day work these two keys are enough.
x
Deletes the character under the cursor — Vim's equivalent of the Delete key. It's a cut, so the character lands in the unnamed register.
r / R
r replaces the single character under the cursor with the next key you press — no need to enter insert mode. Capital R enters REPLACE mode, where every character you type overwrites the one under the cursor until Escape.
.
Repeats the last CHANGE (any command that modified the buffer, including the whole insert-mode session that followed it). The single most-loved Vim feature — learn to structure edits so that '.' does the work for the next N occurrences.

Selection (Visual)

Search & Substitute

Files & Save

Windows, Splits & Tabs

Modes

Macros & Shell

Related references