Once a macro is stored in a register, it can be executed using the pattern
@{name}
where name is the name of the register that holds the macro.
counts can be used when executing macros, so to run the same macro multiple times one can use:
{count}@{name}
After a macro has been executed, one can repeat it using the shortcut @@.
In order to make macro execution as safe as possible, macro execution will stop at the occurrence of the first error.
Starting from the last step of the recording macros section, our buffer should look like this:
Now, lets execute our macro and see it in action. First hit j to go down one line, then @a to execute the macro:
and lets repeat that one more time:
The macro is executing, but we overlooked two things:
-
There are spaces between the tags and the text inside them, and
-
Since we have to hit j between invocation of the macro, it would be more convenient to add this step to the macro itself.
Lets undo these changes, then look at how to edit macros to make these changes.