Vim: multi-file replace `:%s`
So you wanna run vim’s
s command on multiple files.
Open all files you want to replace as buffers
Run the command on all files and update the content
:bufdo %s/heading/root_text/g | update
Don’t forget to overwrite if you are satisfied with the results
Done! Note that this is not just limited to replacing. It applies to any command, or set of commands.
If you already have some buffers open and you’d rather make a new list of files, you can replace: