I do use the same
vimrc on my local machine and on a remote machine to which I connect through SSH. I keep the
vimrc synced between the machines for commodity. My issue starts when I set
mouse=a, I really like using it since I do have a lot of stuff in
On my local machine, to copy to the primary or clipboard buffers I let the mouse enter visual mode (
selectmode=) and do
"*y. That's all fine. On the remote machine I force
mouse= to be empty and use the terminal's copy and paste functions.
If I enable
mouse=a on the remote machine I can't copy and paste from it anymore because Vim takes over the mouse and the terminal never sees the selection. For now I'm lucky that the remote machine have Vim 7.4, and since I use Vim 8.0 on my local machine the following works:
if 800 >= v:version set mouse=a else set mouse= endif
But it will break shortly since I'm about to update Vim on the remote machine.
I've tried connecting with
ssh -X and
ssh -Y to check if I can make the mouse work but without success. The selection works but the buffers (on the local machine) are not updated with the yank. The Vim process on the remote machine has a GUI compiled in and there is a Xorg running there, but the Vim process runs on that side of the connection and the Xorg buffers used are on that side. (Yes, this makes things more complicated.)
- Is there a way to make Vim use the Xorg buffers on the connecting machine?
- Or, is there a way (in VimScript) to test whether Vim is running in an SSH session as opposed to a local PTY?