vim: Executing a list of editor commands
editor, vim
Solution
(Update: s/buffer/register/g)
If you can yank all of the commands you want to run into a register, then execute the register ?
http://www.bo.infn.it/alice/alice-doc/mll-doc/linux/vi-ex/node24.html
For example, if you have a file like:
abc
def
ghi
dd
dd
Then do
:g/dd/y A
This yanks all lines with dd and appends into register a
Then if you are on the first line of the file, and type:
@a
Then 2 lines will now be deleted, and the file should look like:
ghi
dd
dd
Problem
Is there a way in vim to give a list of editor commands? I want to execute a series of 'global' commands, and there is some pattern to the commands. So I would ideally like to generate the list of commands (using regex search & substitute), and then run them, instead of having to type in each command. Thanks! Gaurav