Vim 9 · Searching and replacing

Replace in a selection

After selecting lines in visual mode, replace only inside them. Vim fills in the range.

:'<,'>s/old/new/g

Official Vim 9 documentation

More searching and replacing commands

All searching and replacing commands · Vim 9 cheatsheet

Was this page helpful?