I already know that you can copy something the a register using: (plus a yank, delete, etc. command)


I also understand that you can append to the a register using:


In addition I understand how to copy something to the clipboard register using:


The question Here is what do I type to append to the clipboard register?

Edit: This probably shouldn't be necessary but my VIM version is:

Vi IMproved 7.4 (2013 Aug 10, compiled Jan 2 2014 19:39:59) Huge version with GTK2 GUI.


You have to use

:let @+ .= your_expression

see stackoverflow. The problem, as you have understood, is that you cannot capitalise the + character.

For example, to add a line in your buffer to the clipboard, place the cursor on the line and yank it with yy. Then type :let @+ .= @0 to run (:) the command let to append (.=) register (@) 0, which always holds the last yank, to register + which is a representation of the clipboard.

For example, to add the string "abc" to the clipboard, type :let @+ .= 'abc'.

(To change the X11 selection instead of the clipboard register + use register *).

vim has a huge set of commands. If you plan to adopt it as your favourite editor it is worth putting some effort into knowing, at least superficially, some of them. Most vim users probably only use about a dozen commands and are not interested it its true potential. It's a pity, as such tools could significantly reduce their workload.

You might like Learn Vimscript the Hard Way. The builtin vim help is also viewable on the web at sourceforge , with this page on The Vim script language.

  • 1
    An answer in the format of my question would be appreciated. I don't know what the let command nor the @ sign mean nor do. An explanation would be much appreciated. Would I do "+ . ? – Jason Basanese Jul 4 '15 at 21:21

Only the 26 named registers a to z can be appended to. But the "unnamed" register " always points to the last used register. We can use this to our advantage because this also means that the item appended to a named register is also appended to the "unnamed" register.

Here's an example:

1| Line 1
2| Line 2
3| Line 3
  1. Yank Line 1. "+yy.
    • Check the registers with :reg + ".
    • You'll notice they both contain Line 1.
  2. Append Line 2 to register "a" by typing "Ayy. (Or use any named register you wish).
    • Check the registers with :reg a + ".
    • Register + remains the same as expected.
    • Register a has Line 2 appended to whatever was there before.
    • Register " has both Line 1 and Line 2.

:help quotequote

Side note: look into setting the "unnamed" register to the clipboard so you don't have to type "+yy each time. If set, you can just use yy to yank to the clipboard.
:help clipboard
:help 'clipboard'
:help clipboard-unnamedplus
:help clipboard-unnamed

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.