zhuang@linux:~/reading/practical-vim/11-macros/$ less
Macros
This post extracts some knowledge from Practical Vim Chapter 11 – Macros.
The q key functions both as the “record” button and the “stop” button. To begin recording our keystrokes, we type q{register}, giving the address of the register where we want to save the macros.
The @{register} command executes the contents of the specified register. We can also use @@, which repeats the macro that was invoked most recently.
The golden rule is this: when recording a macro, ensure that every command is repeatable.
22 is a good number.
~ toggle character case.
qA qB to append commands to the end of Macro.
:argdo normal @aExecute the marco in all of the buffers in the argument list.
:let i = 1
qa
I<C-r>=i<CR>)
<Esc>
:let i += 1
qWe can edit the macro as plain text by pasting it into the document and back to the register.
zhuang@linux:~/reading/practical-vim/11-macros/$ comments