I have a list of files i’ve opened in VIM using this command:
vim `cat list.txt`
I’m looking to run this command on all open files:
:99,104 norm i#
(from lines 99 to 104, insert a comment “#”) <–simple, works
When I run the above command to insert it works as expected on the current file. How do I get VIM to run the exact same command on all open files? I tried :argdo, :windo, :bufdo but didn’t have any luck.
Any suggestions?
I guess
bufdowould work, if you haveset hidden(to allowbufdoto change buffers without saving) before:Then save all files with
:bufdo! wor:wa.(Note:
set hiddencould be replaced withset autowriteas well.)