Repeat Last Change

. โ€” replay the last change. The single most useful key.

Keys: .

The . command repeats the last change โ€” exactly what you did, including any inserted text. It is what makes Vim feel like Vim.

If Vim has a single most-loved key, this is it. . replays the last change. Not the last keystroke, not the last motion โ€” the last change. That distinction is the whole reason . feels magical.

Repeat last change
KeyNote
.
The dot command

Reference

Key Action
. Repeat last change at cursor
{n}. Repeat last change with new count {n}
".p Paste the actual recorded change as text

Worked example โ€” .

The single most powerful key in Vim.

Step 1 ยท
dot.repeat
Step 2 ยท cwxxx Esc ยท cw to xxx, Esc.
cw to xxx, Esc.
Step 3 ยท j0 . ยท . โ€” same change at new cursor.
. โ€” same change at new cursor.

Dot replays the last change (anything that modified the buffer). Cheap revolution: structure your motions so dot becomes useful.

Step 4 ยท j0 . ยท . again โ€” third line.
. again โ€” third line.

Move-and-dot is a Vim idiom. Beats keyboard macros for trivial repetitions.

โ–ถ Try this in the simulator

See also: Dot with Counts, Dot Patterns, {key:cgn} โ€” Change-Next-Match Loop, Undo and Redo