Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

1 Answer 1

up vote 6 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. –  Jacob Johan Edwards 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
2  
@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

 
discard

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.