How to apply changes to all VIM open buffers

by @im_a_muppet on January 13, 2011

A simple way to make modifications to a lot of file is to open all of them in vi and apply the search and replace to every file that is buffered. The easiest way to do this is as follows

  :bufdo %s/pattern/substitution/ge | update

bufdo – apply to all buffers

e – ignore no pattern match errors in a buffer

update – write only if the files changed

blog comments powered by Disqus