Search code examples
vimclipboardviclipboardmanager

How to access old entries of Vim Clipboard?


When I want to copy a line and paste it in the current line after deleting the current line's contents, I end up pasting the same line that was deleted as the clipboard entry gets changed after pressing d


Solution

  • You can access the previous content of the unnamed register with registers "1 to "9:

    "3p
    

    Register "0 always contains the last explicit yank:

    "0p
    

    And you can yank to a named register "a to "z. If you want to save a snippet for later, using named registers is a very good idea:

    "ey
    "ep
    

    See :help registers.