I initially posted a question assuming there was something to type that would signal append other than just using upper-case letters. How does one append to the clipboard register in vim?

Unfortunately, this resulted in finding out the impossibility of that type of solution, so I decided to reword the question. I was given many a reference to this post vim append to clipboard, which I don't understand. In that post they use my_expression, what does that refer to? Does it refer to the letter I want to set as +? If so, would I use the capital version?

My question boils down to: I want a thorough description of what to do to set clipboard register to a different name so it can be appended using the capital form. Answers have been copied and pasted with little explanation.

DO NOT PASTE let @+ .= my_expression here and call it a day.

If needed here is my vim version:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 2 2014 19:39:59) Huge version with GTK2 GUI.
  • 3
    You can not "set clipboard register to a different name". You are asking for some custom functionality written for you, that does something like this: when you append to a named register (e.g. using Z, i.e. append to z), to automatically also append to the clipboard register (+) - a kind of sync between a named register and + register. You had your answer here: vi.stackexchange.com/a/3823/1800, but based on your reply, you seem to want to make Vim bend to you without learning it first.
    – VanLaser
    Jul 4 '15 at 22:52
  • 1
    // , This is a case of someone not knowing the proper "question surface" in which it is appropriate to ask questions about. Imagine an alien, new to cars, after learning how to make it go forward and backward, how to make it go up. Dec 29 '15 at 18:27

You wouldn't have to spam us with all those questions if you took the time to read — and try to understand — the documentation.

There is only one clipboard register, "+ and you can't append to that register directly like you could with "a-z, simply because there is no such thing as "capital +".

If you want several yankings to end up in the clipboard register, the simplest solution is to append to a temporary register:


and, when you have everything, export the content of that temporary register to your system clipboard with:

:let @+ = @a

A more involved way would still imply to append to some named register and export to your system clipboard with something like:

:call setreg('+', @a, getregtype('a'))

And that's the end of the story.

To sum it all up:

  • You can't rename the clipboard register.
  • You can't append to the clipboard register the same way you can append to named registers.
  • Don't fight against Vim.
  • That is what I was looking for, a thorough explanation. Which you provided perfectly. Unfortunately when I see let and @ I hadn't known what they do but it just dawned on me when reading your response, thanks! Jul 5 '15 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.