← All lessons

17. Macros

Step 5 of 5

Appending to macros

Sometimes, you’ll record a macro and then think to yourself “damn — I forgot to do this small thing at the end”. If this happens, you don’t have to re-record the entire macro. You can append additional steps to the macro by recording to the uppercase register where it’s stored!

So, if your macro was originally recoded with qa, you can re-enter recording mode but append to the macro that you recorded previously with qA.

This is useful for the common situation where you only need to make a small change at the end of the macro’s sequence of actions.

Try it in the editor. First, try recording a macro into the "a register with qa. Make the macro prefix the line with XXX. Then stop recording.

Try re-running the macro a few times to get a clear idea of what it’s doing.

Then, start appending to the "a register macro with qA. This time, add XXX to the end of the line, and stop recording.

If you re-run your macro with @a again, you’ll notice that it includes the steps from both of the recording processes. Nice!

Loading editor…