normal·mode
~ / macros / record-and-replaylesson 1/6

Record and replay: q, @ and @@

Record an edit into a register once, then replay it wherever you need it.

3 drills

  1. Record once, replay twice: Make the change on line 1 while recording into register a (qa … q). Then move down with j and replay it with @a, and once more with @@.
  2. Move, then replay: Only some lines need the change. Record it on line 1, then jump to each of the others (3j, 2j…) and replay with @a and @@.
  3. A macro that finds its own target: Begin the recording with a search (/…<CR>) so the macro jumps to the next line that needs fixing by itself. Record it once, then replay with @a and @@ without moving by hand.

The drill editor loads in your browser.

outside the editor the page is in normal mode: ? keymaps · / find · : commandsfound this useful? ☕ support it ·credits · source · not affiliated with Vim or Neovim