Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I select the + register? I have problems following the instructions below to copy/paste text from vim to another vim:

In the vim, highlight, select + register, and yank (save) to it:

In the second vim, select + register, and paste from it:

I think I'm pressing the wrong keys. When it says "+y, do I simply hit the keys ", +, y in sequence? (That is, Shift+', Shift+=, y). It does not work for me.

I am using Red Hat and vim in an X11 terminal. And vim version is

$vim --version | grep xterm_clipboard
-xterm_clipboard -xterm_save
share|improve this question
Can you use gvim, instead? That is how you can use the X clipboard to transfer text using the X clipboard. Yes, you use those exact keys. Your vim doesn't have xterm_clipboard support. – Keith May 23 '11 at 19:21
yes, gvim worked! – Richard May 23 '11 at 19:29

Vim uses the system cut-and-paste mechanism to copy text between instances. When you run vim in a terminal, it doesn't have direct access to any cut-and-paste mechanism. If vim is running in xterm or some other terminal that provides access to X selections and clipboard contents, vim can use that; however your vim binary is compiled without support for that feature.

If both vim instances are running on the same machine, you can use a temporary file to communicate:

:w ~/vim.tmp
:r ~/vim.tmp

If both vim instances are connected to the same X display (in that the DISPLAY environment variable points to the same X display, the vim programs themselves don't need to have any kind of X support), you can use the X selections via an external program such as xsel or xclip. You can omit the p or -selection primary or choose a different selection (-s/secondary or -b/clipboard). Use :w ! (note the space) to copy:

:w !xsel -ip
:w !xclip -i -selection primary

and :r! to paste:

:r !xsel -op
:r !xclip -o -selection primary
share|improve this answer

Your examples use the + register. To use the ? register, simply use the same commands, replacing the + with ?.

for example:


If you're trying to paste between instances of vim using the system clipboard, you'll want to prepend a g to your commands, thus

share|improve this answer
I don't think he's talking about the ? register; the ? was just ending a sentence that contained a question. He's using the + register but needs it to work between vim instances (so your part about using the system clipboard will probably solve his problem) – Michael Mrozek May 23 '11 at 16:47
still not working with "+gy – Richard May 23 '11 at 16:58

On Red Hat (and Fedora), use the /usr/bin/vimx command. The + register (system clipboard) will work if you use the vimx command.

vimx has support for the system clipboard compiled in:

$ vimx --version | grep xterm_clipboard
+eval            +mouse_dec       +startuptime     +xterm_clipboard

vimx is in the vim-X11 package, which also contains gvim.

Use this alias:

alias vim=/usr/bin/vimx
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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