I Can't copy FROM vim. Can you diagnose my .vimrc file?
Solution 1:
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.
Solution 2:
How do you copy things from Vim? Vim uses several registers where the +-Register is used to share information with the systems clipboard. For instance, to copy a whole line into systems clipboard use
"+Y
After that just use CTRL-V to paste like always.
Solution 3:
Press the shift
key when selecting text if you have mouse support enabled on vim. The normal selection (without shift
) enables VISUAL mode. Using shift
passes mouse events to your terminal emulator.
Solution 4:
From one of your comments:
I've seen this suggestion in several places, but it doesn't work for me.
Solution:
You probably don't have vim
installed with the clipboard
feature enabled, which is required for being able to copy/paste to/from the system clipboard.
If you type vim --version
at the command line, you'll probably see -clipboard
in the features list. Try compiling vim from source with the following option:
./configure --with-features=huge
(include other options you need) and then proceed with make
and make install
. Now you should see a +clipboard
in your features list and you can yank to the system clipboard using
"+y
and paste from the system clipboard using
"+p