How can I run a certain command on only specific buffers (a list of buffer names, or a buffer name pattern etc) ?
1 Answer
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:
- Meet the arglist
- Populating the arglist
- Using :argdo to change multiple files
- Project-wide find and replace
For more help see:
:h :args
:h :argdo