1 min read

Find and Replace in Vim

I want to provide myself with some helpful snippets on here, the most frequent I search for is how to find and replace in vim. I always remember the gist of it, but the wiki provides the extra bits I forget.

:%s/find/replace/g

Search and replace
Vim provides the :s (substitute) command for search and replace; this tip shows examples of how to substitute. On some systems, gvim has Find and Replace on the Edit menu (help:promptrepl), however it is easier to use the :s command due to its command line history and ability to insert text (for exa…