Mac – How to cancel recording a macro in Vim

macrosvim

Imagine I had recorded a macro and then I've occasionally started recording a macro into the same register. Can I interrupt the recording so that the original macro is preserved in the register?

I know that I can do :let @b=@a to copy the macro from register a to register b and thus preserve it but maybe there is a more straightforward way?

Best Answer

When you record a macro, the register is emptied first and filled as you go so it's very unlikely that there exists a built-in way to save your previous macro while you are halfway through another recording. A way that doesn't involve writing a wrapper around q, that is.

I and a lot of people use a temporary register (@q, for example) for all our one-off recordings. Maybe you should, too.

Related Question