I prefer using VIM in a gnome terminal (On Fedora 19) instead of using GVIM.

But I can't seem to copy to the system clipboard.

I'm pulling my hair out trying to figure this out because other threads showing hacky xclip stuff never worked for me.

My VIMRC: .vimrc on pastebin

Which contains

set clipboard+=unnamedplus


vmap <C-c> "+yi
vmap <C-x> "+c
vmap <C-v> c<ESC>"+p
imap <C-v> <ESC>"+pa
imap <C-v> <Esc><C-v>a

My GNOME terminal has the following keyboard shortcut setting:

Copy = Ctrl+C Paste = Ctrl+V

(also tried with ctrl-shift-c and it didnt make a different)

Is there some Fedora/Gnome thing I need to add? GNOME Shell version is 3.8.4.

My vim version data is here: http://pastebin.com/raw.php?i=JTxYNbUF

  • 3
    To start with, don't use += to add "unnamedplus" to 'clipboard'. Use ^= instead. With +=, "unnamedplus" will be put after the "exclude:" portion of 'clipboard' and won't be seen as the "unnamedplus" option. – garyjohn Oct 3 '13 at 18:42
  • that doesn't seem to work either. when I highlight text in VIM using the mouse in gnome terminal, the copy command is greyed out too. So I'm not even sure if this is a VIMRC thing or a gnome terminal issue – dmix Oct 3 '13 at 18:58
  • Could you add the full output of $ vim --version to your question? – romainl Oct 3 '13 at 19:38
  • 3
    If you are using the terminal vim that came with Fedora 19, it probably wasn't built with support for X11 or the clipboard. Execute :version and look for X11 and xterm_clipboard. They should both have + in front of them. If they have - in front instead, you'll need to use a different build of vim. The easiest way to do that is to put alias vim=gvim -v in your ~/.bashrc. The -v option will run gvim in terminal mode, and gvim is always built with support for X11 and the clipboard. – garyjohn Oct 3 '13 at 19:39
  • Have you tried highlighting the desired text and then clicking the mouse wheel to paste? I know this won't fix the grayed out copy option but it should allow you to copy and paste. If your mouse has no wheel, then you can click both the left and right buttons together to create the middle-click. – Timothy Martin Oct 3 '13 at 19:39

Since you shared your version data, I can see that it says -clipboard. This means that vim wasn't compiled with the +clipboard feature, thus it can't access the system clipboard. You can probably remedy this by installing a vim-gtk package or equivalent. If you compiled it yourself, just add the appropriate flag.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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