Basically the opposite of this question.
This is on macOS.
I copy from a program using ⌘C and I want to add that text to
"0 so when I
cw or something similar I don't obliterate my copied text. How do I paste to the register?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.Sign up to join this community
I think there's no way to do what you want (i.e. populate the
"" register from external apps but without touching it from vi), but there's a workaround. It may not be exactly what you expect, but it is worth a try (at least this is how I work and I don't miss the default behaviour at all):
clipboardas explained in the post you linked.
:help quote_) when you change, paste, or delete things. Because it is tedious to do so manually, you can map the desired operators:
noremap d "_d noremap dd "_dd noremap D "_D noremap x "_x noremap X "_X noremap c "_c noremap cc "_cc noremap cl "_cl noremap C "_C xnoremap p "_dP
I also use shortcuts for yank and delete at the same time:
noremap yd d noremap yD D noremap ydd dd
Of course, this means that no changed text would be kept on any register unless you manually yank it before it is changed or, you manually chose another register. I may be missing something, but to be honest I don't relly on vi registers at all, especially because I use a little app that provides system-wide "registers"