Vim Recall繁體中文

Replay the last macro again

@a then @@

Example

Normal mode on line 1. Lines: alpha, beta, gamma.

Before
alpha
beta
gamma
Cursor on line 1, column 1
  1. qaI# <Esc>jq Record macro a · prefix alpha with # and a space; move to beta
  2. @a Replay a · prefix beta; move to gamma
  3. @@ Replay a again · all three lines now start with # and a space
After
# alpha
# beta
# gamma
Details & Vim help

Use @@ to execute the most recently used register as a macro.

Keep applying a recorded edit without remembering its register name.

The example starts before recording on line 1. @@ repeats the last @ register; it does not start or stop recording. A macro error can stop playback, so test once before adding a count.

Record qaI# <Esc>jq on line 1, run @a on line 2, then @@ on line 3. The space after # is inserted text.

Try it in Vim

  1. From line 1, type qaI# <Esc>jq, including the space after #. This records a prefix insertion followed by j into register a.
  2. On line 2, type @a to prefix it and advance.
  3. Type @@ to do the same on line 3.