Replace in Visual Selection in Vim

Substitute across the current Visual selection with :<,>s/{old}/{new}/g. This scopes replacements to the selected range.

Commands you practise

:'<,'>s/{old}/{new}/g
Run a search-and-replace restricted only to your visually selected lines. It is the perfect way to rename variables locally without collateral damage.

Levels

  1. Scope It Out (easy): Change 'draft' to 'final' only within the active block.
  2. Locally Variable (medium): Rename 'temp' to 'data' strictly inside the parse function.
  3. Zone of Control (hard): Upgrade 'deprecated' to 'legacy' only for the active deployments.

Each level opens a real Neovim session in your browser with a start file and a target file. Edit one into the other in as few keystrokes as you can, then race the vimbot's solution.

Part of VimGolf.ai Premium ($10 once, lifetime). Region: Find & Replace. See the whole skill map.