normal·mode
~ / search / gnlesson 7/7

gn: edit match after match

Change, delete or skip each match in turn, and count them.

4 drills

  1. Change every match with cgn and .: Change every whole-word match of the word under the cursor. Set the pattern with *, change one match with cgn, then repeat with ..
  2. Change some, skip some: Change the matches the target changes and keep the others. Use cgn and . to change, n to skip.
  3. Delete every match with dgn: Delete every match of a pattern whose matches differ in length. Search once, then dgn and ..
  4. Change part of each match (\zs): Change only the value after the key in each match. Use \zs so the match starts at the value, then cgn and ..

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