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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…