4 ms·
Try bufdo, argdo, windo, and tabdo depending on the subset of files you'd like to modify. E.g., to replace "foo" with "bar" in all open buffers: :bufdo %s/f
by rbright 15y ago
Try bufdo, argdo, windo, and tabdo depending on the subset of files you'd like to modify. E.g., to replace "foo" with "bar" in all open buffers:
:bufdo %s/foo/bar/g | update
Although I wouldn't knock `bash command madness' for this sort of task. :)
The Unix shell is pretty much designed for advanced text manipulation across files. E.g., to replace all instances of foo with bar in HTML files, recursively:
$ find . -name '*.html' -exec perl -i -lpe 's/foo/bar/g' {} \;
vim and the shell are not so far apart and complement each other well, so it pays to understand them both.
- crowsfan85 15y agoI agree. I've also found this perl script handy for recursive find/replace: http://www.neilgunton.com/doc/deep http://www.neilgunton.com/doc/deep $ deep replace "foo" "bar" "*.html"