GVim compiled from source opened via SSH -X does not copy paste on selection

I’m using SSH (with -X specified) from a Ubuntu box to a RHEL4 box and running GVim. It opens as expected in my local X, but the copy and paste via select doesn’t work. I cannot select text in GVim and paste in a local window, nor can I select text from a local window and paste in GVim. This works, however, when I SSH (with -X specified) to a different RHEL4 box.

Is there something I need to install on the remote machine?

I’m suspecting that it has something to do with the compile flags I used, but I don’t have a clue which one. I’ve tried --enable-gnome-check and --enable-gtk2-check, since I’m running gnome on my local machine, but that did not resolve the issue.

EDIT: Running vim --version on both versions of vim shows many differences, the most notable being that the machine which has no issue is for the GTK GUI and the machine which does have an issue is for the X11-Motif GUI. I can’t configure the problem box to use GTK though since I don’t have everything I need installed.


  • Thanks for the help so far, guys.
  • To clarify, copy/paste via select
    works on a GVim window spawned from
    box A, but not on a GVim window
    spawned from box B. Both box A and
    box B are RHEL4 U8.
  • When I select
    some text in the GVim window, I can
    paste it via right-click within that
    window, but I cannot paste it into
    anything running locally. When I
    select something locally, I can paste
    it locally but when I paste into the
    GVim window, it pastes the last thing
    selected in the GVim window, not the
    last thing selected locally.
  • Just to make it a bit freakier, sometimes I open a second GVim window from the same box, I can paste into that second window (though still not the first), but I still cannot select something in that window and paste it locally.
  • I get the same behaviour using Ctrl-Shift-C. Holding shift while selecting with the mouse prevents selecting. Ctrl-Shift-V starts block selection in vim, not pasting.
  • I am running Parcellite 0.9.2 on the local box, but closing it doesn’t make the problem go away, and it is not interfering with the other box.


  • The machine that is presenting the problem is a vitual machine running on VM Player.


  • A co-worker that is also SSHing to a virtual RHES4 U8 box does not have the same issue but he used the stock vim install on the VM whereas myself and another co-worker with the problem compiled vim from source. Could there be a compile flag we need?
  • I tried installing VM tools on one of the VMs, but it had no effect on this issue.


  • The .vimrc between my two boxes is the same, scp’ed over.
Asked By: Robert Gowland


Just some thoughts without actually testing. If you are using the shell to launch your ssh session, you can use Ctrl-Shift-c and Ctrl-Shift-v to paste. Otherwise, would a right-click on your selection propose ‘copy’ to you?

Answered By: Morlock

One thing that I would try is to make sure that you actually let X handle the selection. If you have set mouse=a in your vimrc file then vim will interpret the selection as its visual mode. If this is the case, try holding Shift when selecting.

Your terminal emulator may have its own mechanism for copying and pasting, for example gnome-terminal uses Ctrl Shift c for copying and Ctrl Shift v for pasting (as Morlock stated in his answer). You can use that instead.

Answered By: phunehehe

Turns out the problem was that vim on the remote was not compiled with GTK. This happened because the necessary package was not present on the remote box. Thus, even with the --enable-gtk2-check compile flag set, it was not actually including GTK.

To fix it, log on to the remote machine and:

  1. Install gtk2-devel,
  2. re-configure, re-make, & re-install vim

A co-worker figured this out eventually.

Answered By: Robert Gowland
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.