How do I append multiple yanks into one named register and paste them as one block?
Answer
"ayyj"Ayyk"ap
Explanation
Named registers are much more powerful when you treat them as accumulators instead of one-shot clipboards. This trick yanks one line into register a, appends another line into the same register using uppercase A, then pastes the combined result in a single put. It is useful when assembling snippets from different places before inserting the final block.
How it works
"ayyyanks the current line into registerajmoves to the next line"Ayyappends this line to registera(uppercase register name means append)kreturns to the original insertion point"apputs the entire accumulated register content after the current line
Example
Given:
alpha
beta
Press:
"ayyj"Ayyk"ap
Result:
alpha
alpha
beta
beta
The inserted pair comes from one combined register payload, not two separate puts.
Tips
- Use
:reg ato inspect the register before putting - Clear a register with
:let @a=''when building a fresh block - This pattern scales: append from many locations, then put once where you need it