Suppose that I have recorded a long macro with many commands and special characters. Odds are I have made an error somewhere 🙂 How can I edit a macro, correct errors and save it again?
For example:
I wish to copy a line and then increase the digit in it by one.
Macro for this is
yyp/\d<C-A>
but it is saved as
yyp/\d^M^A
and I can’t see this special characters when I paste the register. I also have to play with ‘let’ when I wish to copy a register, because standard paste to screen and copy to another register doesn’t work. How can I efficiently edit register with special characters?
Thanks
What do you mean when you say you “can’t see the special characters”? What special characters? You should be able to see the
^Aand^Mfine, which represent<C-A>and the<carriage return>respectively. That’s all you need.So do just paste the register into a buffer. Then edit and yank back into a register and execute as a normal macro. If you want to edit the
<C-A>to be something else, say,<C-E>, then just delete the^Athat shows up on paste and put a<C-E>in by pressing<C-V><C-E>(or<C-Q><C-E>if you’re on Windows with windows compatibility on). It will show up as^E, but that’s how it’s supposed to be.