editing macros
If you need to edit a macro (because you forgot to remember to add a motion key for the macro to be effectively repeatable):
:let @q="
open theq
register<C-r><C-r>q
paste the contents of the q register into the buffer- ^ add the missing motion to return to the front of the line
- " add a closing quote
finish editing the macro
An alternate way of doing this is:
"qp
paste the contents of the register to the current cursor positionI
enter insert mode at the beginning of the pasted line- ^" add the missing motion to return to the front of the line and add a quote
return to normal mode "qyy
yank this new modified macro back into theq
registerdd
delete the pasted register from the file your editing
(Use ctrl+v <key>
to get the actual character key for escape sequences for macros and whatever else)