Update: I have a newer version of this post available here

There are plenty of ways of doing a search and replace in multiple files in linux, but this is how I do it with vim.
$> vim firstfile secondfile theothers*
:windo %s/this/that/g

The :all will split the window to show you all the files at once.
This would not be the best option for lots of files, but for a small number you get to see the changes that are made.
The :windo will execute the given command for all the files in the current window.
Note this wont affect windows in other tabs.

If you want to undo that change in all buffers, you can use the same method:
:windo undo
When your finished, you can save and quit with:
There are plenty of variations, for more infomation checkout the help pages for these:

Search and replace, vim and git

Search and replace, vim and git Continue reading

Using netrw instead of NERDTree for Vim

Published on December 28, 2016