Subvert with Vim Across Multiple files
-
Open one of the files you want to be included in your find and replace search.
-
Add that open file to your args list with
:argadd %
or:arga %
-
Repeat 1-2 above for all the files you want to include. You can do things like include all .js files with
:argadd *.js
-
You can check that you have all the files by typing
:arg
You will get a list that looks something like this.
- Run your Subvert (or normal substitution) on the arglist with
:argdo
. For example, if you want to perform a Subvert use:argdo %:Subvert/find/replace/gce
If you don’t have Subvert you could do the built in substitute with:argdo %:substitute/find/replace/gce
or more compactly,:argdo %:s/find/replace/gce
The ‘e’ means you want to ignore errors. The ‘c’ means to confirm each.
- If you included ‘c’ then you will have to confirm each change which will present you with the following dialog. The confirmation would look something like this.
similar to :argdo
, check out using :bufdo
and :windo