vim Vim Registers Append to a register


Yank all lines containing TODO into a register by using append operation

:global/TODO/yank A

Here, we are searching for a TODO keyword globally, yanking all lines into register a (A register appends all lines to a register).

NOTE: It is in general a good practice to clear a register before performing the append operation.

To clear a register, in the normal mode, type qaq. Confirm that the a register is empty by typing :reg and observing that a register is empty.