Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

On my mac I solved the problem this way:

:set clipboard=unnamed

On my debian I use the + clipboard:

:set clipboard=unnamedplus

However the methods above don't work on my Ubuntu 12.04 with Unity desktop environment. Does anyone know how to fix this?

share|improve this question
up vote 7 down vote accepted

In vim, the "+ register points to the system clipboard by default. But it sounds like you already know that.

That register probably isn't working because you need to install the gvim alternative. The default vim can't interface with the X clipboard (eg "+p will fail). Just do:

sudo apt-get install vim-gnome

The command vim will be updated to use gvim instead, and you should be able to yank from and paste to your system's clibpoard.

share|improve this answer
Thank you for the answer. I tried this with gvim and it worked for me. Will use it instead of default vim. – Roman Prykhodchenko Aug 5 '12 at 20:57
Do you know how to get this to work in a terminal vim? (Not gvim) I have installed vim-gnome and my vim --version includes +xterm_clipboard, but the "+ and "* registers work only in gvim as expected, not in vim. – Philipp Wendler Aug 6 '12 at 10:32
@PhilippWendler Hm, that's odd, it should work. Can you post the output of readlink -e /usr/bin/vim? Perhaps your alternatives system is launching the wrong thing when you call vim in the terminal. – Jjed Aug 6 '12 at 13:34
@JacobJohanEdwards The output is /usr/bin/vim.gnome. This is the one which lists +xterm_clipboard, and which I use. Running :version inside my vim also shows it. Any ideas how to debug it? – Philipp Wendler Aug 6 '12 at 13:53
@JacobJohanEdwards Ah, I found a relict in my .vimrc which is the culprit (I copied my .vimrc from some website long ago): set clipboard=exclude:.* Thanks for trying to help me. – Philipp Wendler Aug 6 '12 at 13:56

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.