Search code examples
vimcopy-pasteyank

Copy multiple times before pasting all of the contents in vim


In vim, would there be a way to copy multiple times, accumulate each of them into the clipboard, and then later paste all of them at once where each contents are separated by newline?


Solution

  • Use uppercase registers to append. For example, let's clear and yank a line to register "a, append a line, append another line, then paste:

    "ayy
    "Ayy
    "Ayy
    "ap
    

    Flag > in cpoptions inserts a line break before the appended text.