Find and replace can be a godsend when you need to make the same text change multiple times. Let’s hope though that it isn’t multiple string/integer/etc. literal changes because that wouldn’t be very efficient coding – as in not DRY.

To do a global (within the current buffer) find and replace you issue the following:

  • : – issue VIM command
  • % – the buffer in the current window
  • s – substitute
  • g – replace every instance found

If you would like to find and replace within a selection, enter visual mode, make a selection and type:


And that’s it!