The Dot Command

What . repeats

. repeats the last change — not the last motion, and not a whole command line. An edit is a change if it modified the buffer: x, dw, ciw, A;<Esc>, >>.

ciwname<Esc>     " change a word
w.               " next word, same change
w.               " and again

Making edits dot-repeatable

The habit is to make each edit self-contained, so repeating it makes sense somewhere else:

  • ciw beats bcw — it works wherever the cursor sits in the word
  • A;<Esc> beats $a;<Esc> — the append-to-end is part of the change
  • Prefer text objects (i(, i", ip) over counted motions

n then . is the classic loop: find the next occurrence, repeat the change. For a version that finds and changes in one key, see cgn and dot.