Vim searching through all existing buffers

Use the bufdo command.

:bufdo command

:bufdo command is roughly equivalent to iterating over each buffer and executing command. For example, let’s say you want to do a find and replace throughout all buffers:

:bufdo! %s/FIND/REPLACE/g

Or let’s say we want to delete all lines of text that match the regex “SQL” from all buffers:

:bufdo! g/SQL/del

Or maybe we want to set the file encoding to UTF-8 on all the buffers:

:bufdo! set fenc=utf-8

The above can be extrapolated for Windows (:windo), Tabs (:tabdo), and arguments (:argdo). See help on :bufdo for more information.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)