Replace Across File in Vim

Run a global substitution across the whole file with :%s/{old}/{new}/g. It replaces every match of the pattern.

Commands you practise

:%s/{old}/{new}/g
Replace every occurrence of a pattern across your entire file at once. It is the ultimate tool for instant, painless global renames.

Levels

  1. Promotion Day (easy): Promote all five 'dev' environments to 'prod' in one go.
  2. British Accent (medium): Localize this CSS file by replacing all instances of 'color' with 'colour'.
  3. Constant Variables (hard): Convert all 'var' declarations to 'const' without breaking variable names starting with 'var'.

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.