0

I work on a remote server and would like to yank stuff to the server's clipboard. However "+y gives me an error flash (visual terminal bell) and when quitting vim, I can't paste in the terminal.

Maybe this is an issue with ssh not correctly transmitting Ctrl-Shift-V?

oarfish
  • 1,277
  • 3
  • 10
  • 18
  • 1
    The clipboard is managed by the X server, which is presumably running on your local machine. Applications such as vim running on the remote server won't be able to contact the local X server (and use the clipboard) unless you forward the X connection over your ssh channel. To do that, you'll need to run ssh with the -Y or -X option, or put ForwardX11Trusted = yes or ForwardX11 = yes in your ~/.ssh/config file. – garyjohn Jan 05 '17 at 19:38
  • @garyjohn It is not my intention to copy and paste between local and remote clipboard, but simply from remote vim to remote system clipboard. Maybe I'm misunderstanding you. – oarfish Jan 05 '17 at 19:39
  • No, you didn't misunderstand me. Unless I'm missing something, there is no mechanism to copy and paste from a remote system clipboard. The X-aware applications that you run on the remote server via ssh do not communicate with any remote X server--they communicate with the local X server if X traffic is being forwarded over the ssh connection. – garyjohn Jan 05 '17 at 19:56
  • But when I start vim in an ssh session, this instance should have a + register, right? Even if pasting from it outside vim doesn't work, why would it error when trying to use that register? – oarfish Jan 05 '17 at 20:38
  • What error do you get? – Martin Tournoij Jan 05 '17 at 20:45
  • @Carpetsmoker I see a flash which is what my terminal does when something errors. I don't know where vim keeps logs of such events. – oarfish Jan 05 '17 at 21:43
  • Oh, right. That's called the terminal bell. I thought you got an actual error... Do you have an X11 server running on the machine you're ssh-ing to? Is Vim compiled with +clipboard? – Martin Tournoij Jan 05 '17 at 21:45
  • Now I feel stupid. I checked for the clipboard feature previously and forgot this was indeed not in the binary. I guess we have a culprit. – oarfish Jan 05 '17 at 21:53
  • 1
    So I guess that makes this question a duplicate of our most upvoted question? – statox Jan 06 '17 at 09:20

0 Answers0