Vim Macros#

Recording Vim Macros#

Press qq to start recording into register q [1]. Then do your things. Then hit q again to stop recording.

Editing Vim Macros in a Buffer#

Inspired by This VIM trick BLEW MY MIND - YouTube.

Hit "qp to put register q into the current buffer.

Edit the resulting line. If you need a literal ESC character, hit <C-v><ESC>. See :help i_CTRL-V for more info [2].

Yank the line into register q with "qyy.

Registers#

To yank a word to register a type "ayw.

Show all registers with :reg and the register a with :reg a.

Command Mode#

To paste register a in command mode (:), hit Control-r a. https://vi.stackexchange.com/a/15038