Rnet
Rnet

Reputation: 5040

Vim bufdo with arguments?

How can I run a certain command on only specific buffers (a list of buffer names, or a buffer name pattern etc) ?

Upvotes: 2

Views: 366

Answers (1)

Peter Rincker
Peter Rincker

Reputation: 45117

You are looking for :argdo. Populate the arglist via :args. Then do :argdo {cmd} to run {cmd} on each of the files in the arglist.

:args *.c
:argdo %s/FOO/BAR/ge|update

To see all this in action take a look at some of these Vimcasts episodes:

For more help see:

:h :args
:h :argdo

Upvotes: 7

Related Questions