Vim Tips Wiki
Advertisement
Tip 1512 Printable Monobook Previous Next

[[Vim_Tips_Wiki:New_tips{{{subpage}}}#Search and replace in all buffers|created]] August 10, 2007 · complexity basic · author Sam Inverso · version 6.0


Simple way to search and replace in all 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

See also :help :argdo.

Comments


Advertisement