I found out about Vim\'s substitute command...
:%s/replaceme/replacement/gi
And vimgrep...
:vimgrep /findme/gj project/**/*.r
There's a plugin which endeavours to do just that: Vimgrep Replace.
Oh, wait... there are others: Global Replace, EasyGrep.
For a no plugin solution, perhaps argdo
would help if you could get vimgrep
's output onto the argument list (which can be set with args
), but I can't seem to figure out the details. I'd be happy if somebody took the idea and improved upon it... so here it is.
The basic idea behind the first plugin (I'd guess the others too...) is to use vimgrep
first, then cycle through the matches with :cnext
and apply the substitution command on each line. A function to accomplish this could be small enough to put it in .vimrc. (Maybe you can lift one from the plugins' sources?)
(I suppose hgimenez might be on to a solution, but whether or not it's appropriate would probably depend on the number of files to be processed... The plugins should be ok regardless.)