October 2015
Intermediate to advanced
356 pages
7h 54m
English
| Tip 69 | Append Commands to a Macro |
Sometimes we miss a vital step when we record a macro. There’s no need to re-record the whole thing from scratch. Instead, we can tack extra commands onto the end of an existing macro.
Suppose that we record this macro (borrowed from Tip 68):
| Keystrokes | Buffer contents | ||||
|---|---|---|---|---|---|
qa |
| ||||
0f.r)w~ |
| ||||
q |
|
Immediately after pressing q to stop recording, we realize that we should have finished by pressing j to advance to the next line.
Before we fix it, let’s inspect the contents of register a:
| => | :reg a |
| <= | "a 0f.r)w~ |
If we type qa, then Vim will record our keystrokes, saving them into register a by overwriting the existing contents of that register. If we type qA, then Vim will ...