normal·mode
~ / neovim / repeat-substitutelesson 6/7

&: repeat the last substitution

Run your last :s again on another line, flags and all.

2 drills

  1. Same change, another line: Run the substitution on the first line (it needs the g flag), then repeat it on the other line that needs it with &. Leave the middle line alone.
  2. A count makes a range: Run the substitution on the first line, then repeat it on the last three lines with one counted &. The comment lines stay as they are.

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