Tuesday, May 6, 2008

Search Replace in all Vim Buffers


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



bufdo – apply the following command to all buffers – see :help :bufdo.

%s – search and replace the whole file

g – change all instances in a line

e – avoid an error when the pattern doesn’t exist in a buffer

update – write the file only if changes were made

source : http://vim.wikia.com/wiki/Search_and_replace_in_all_buffers

No comments: