normal·mode
~ / operators / find-and-replacelesson 5/7

Rename one at a time: *, n and cgn

Search for a word, change it once, then repeat at each match you choose.

3 drills

  1. Rename with *, n and .: Rename every copy of the word under the cursor to the target name. Search for it with *, change one copy, then use n and . for the rest.
  2. Change some, skip some: Change only the first and third copies of the word under the cursor. Leave the second one alone.
  3. Change every match with cgn: Rename every copy of the word under the cursor. This time use cgn, so each . both jumps and changes.

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