Linux – I Can’t copy FROM vim. Can you diagnose the .vimrc file

linuxvim

I based my vimrc file on a popular thread here on SO, and although it's great I have a real problem when it comes to copying text from vim to other linux applications. I suspect the error lies in this vimrc since I can copy when vim is loaded from a blank vimrc file.

What's wrong here?

Bonus question: how do i copy from my guest ubuntu to windows?

My vimrc file can be found here: http://dpaste.org/X4MY/

Best Answer

Nothing in your .vimrc file strikes me as a problem except perhaps the line

set clipboard+=unnamed

The issue is that the exclude term of the 'clipboard' option, which is present by default if X is detected, must be the last term. By using +=, you have made unnamed the last term. A better setting would be

set clipboard^=unnamed

which places unnamed first in the option string.

Something else you might try, since an empty .vimrc works for you, is to do a binary prune of your .vimrc file. That is, put a :finish command as the first line in your .vimrc file, restart vim and verify that copying works, then move the :finish command about halfway down your .vimrc file, restart vim and try again. Repeat, trying to narrow down the region that contains the problematic command(s). Commenting-out lines works instead of the :finish command, too. You can keep your .vimrc file open in one Vim while restarting a different Vim to make the whole process go a little faster.