Learn Vim / Do it again — vim

Do it again — vim

The answerCanonical keystrokes: qa I" Esc A" Esc j q @a @@.

Try it on a real buffer

Number these steps. Record a macro that prepends the right… actually simpler: each line needs wrapping in quotes. Record qa: I" Esc A" Esc j q on line 1. Replay on line 2 with @a, then just @@ to repeat on line 3.

apple
banana
cherry

Canonical solution: qa I" Esc A" Esc j q @a @@ · par: 13 keystrokes (vimgolf rules — every keypress counts).

Why it works

@@ replays whatever macro you last ran — no need to name the register again. Run @a once, then @@ @@ … to keep going. The laziest, fastest loop in vim.

Reading about keystrokes doesn't build keystrokes. Try this in a real vim buffer right now — the “Do it again” mission takes about a minute.

Practice free — no signup →

Keep going