Vim: search all rewritable buffers

So

1GvG:s/..../g 

can replace the entire buffer

However, suppose I have several vim buffers loaded, and I want to do: s on top of all the writable buffers; is there any way to do this in vim?

+6
vim replace
source share
3 answers

Since I cannot leave comments, I will repeat what Brian said and added to my 2 cents.

I believe that the team you are looking for is:

 :bufdo :%s/..../g | :w 

Note. This will record every file after making changes, so make sure you are ready for it.

If autowrite is enabled, you must remove "|: w" at the end of the command.

+12
source share

Take a look at bufdo . There are also windo and tabdo . Keep in mind that by default Vim does not auto-detect, so to find / replace commands in the buffer you need to enable autowrite.

+4
source share

Greplace has a feature that supports this. Github also has a version prepared for the pathogen .

0
source share

All Articles