How do I see what keystrokes a macro contains?
Answer
:reg a
Explanation
The :reg a command shows the contents of register a, which reveals the keystrokes stored in the macro. This helps you understand and debug macros.
How it works
:reg adisplays registera's contents- Special keys appear as control characters (e.g.,
^[for Escape) :regwithout arguments shows all registers
Example
:reg a
--- Registers ---
"a I//<Esc>j
This shows macro a contains: enter insert mode, type //, escape, move down.
Tips
^[represents<Esc>^Mrepresents<CR>(Enter)^Rrepresents<C-r>- Use this to verify a macro before running it many times
- You can then edit the macro with
"ap, modify,"add