I often use registers in
evil, but I have a common use case that I cannot seem to resolve. I would like to have all copied text stored somewhere that does not get overwritten when I explicitly make another copy to a specific register.
Here is an example:
I want to copy this FIRST line, so I copy it (without explicitly using a register)
I later realize that I want to copy this SECOND line as well, and I want to be able paste it separately from the FIRST line, so I copy it to a register (ie register
I can easily paste that SECOND line (ie
"jp), but how can I paste the FIRST line? The default register is overwritten by my second copy command (ie
"*p would paste the SECOND line) and my clipboard stores the SECOND line as well (ie
p would paste the SECOND line).
In sum, I don't want to explicitly use a register for all of my copy commands - that is too tedious. Is there a "default" register that I can use that is not overwritten when I copy to a specific register? Perhaps I can bind all copy commands to a specific register?
I prefer a solution that uses pure vim/evil commands, so that it is extensible for my other vim editors and vim plugins (ie JetBrains'
idea-vim). I found my solution by using the
0 register. In my example above, I can paste the FIRST line by running
In hindsight, I think this solution would have been better suited for a vim-related forum, but I hope it proves helpful for other Evil-mode users.