Reputation: 9008
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
Upvotes: 5
Views: 1802
Reputation: 3064
Press <C-r><C-r>q
(here q is the register name) in insert mode. Execute :h ctrl-r_ctrl-r
to see the details.
Upvotes: 0
Reputation: 22226
What do you mean when you say you "can't see the special characters"? What special characters? You should be able to see the ^A
and ^M
fine, 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 ^A
that 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.
Upvotes: 5