Using clipboard through SSH in vim
I have Ubuntu 11.04 desktop and a 11.04 VPS server.
After replacing vim
with vim-gtk
(I don't need GUI though), I'm able to use the system's clipboard in vim
. I'd like to use the same feature in Ubuntu server, but it looks like it doesn't work with ssh -X
.
Is there some way I can enable that feature or do I need to use nano
for that?
The "clipboard" is a feature of X11, so you will need to enable "X11 forwarding" for the SSH connection in "trusted" mode:
$ ssh -Y myserver
(By default, X11 is forwarded in "untrusted" mode, which is somewhat too restrictive. -Y
disables the restrictions.)
Also make sure the server has xauth
and a X11-capable version of vim installed. You can use xsel -o
and xsel -o -b
to verify that the clipboard can be accessed.
To make it permanent, add the following to your local ~/.ssh/config
:
Host myserver
ForwardX11 yes
ForwardX11Trusted yes