1

I'm running vim on a Debian Jessie machine inside of a VirtualBox on my Mac. I'm trying to get yy and p to work so I can copy and paste across different terminal windows by using the system clipboard. Please note the following:

1) echo has('clipboard') returns 1 (I have vim-gtk installed)

2) My .vimrc file is as follows:

syntax on
set mouse=a
set clipboard=unnamedplus

3) I've logged into the ssh session with ssh -XY me@host>to allow x11 forwarding

4) The Debian machine is headless.

5) When I'm logged into the machine directly instead of over ssh, I still can't copy to the system clipboard.

When I do yy or even "+yy and then do :reg to look inside the registers, there is no listing for the "+ register.

Not sure what else to try.

Martin Tournoij
  • 62,054
  • 25
  • 192
  • 271
StevieD
  • 1,492
  • 1
  • 16
  • 24
  • What does :reg + give after "+yy? Also, I'd recommend trying set clipboard=unnamedplus,unnamed. – Tumbler41 May 01 '17 at 16:18
  • :reg doesn't show the + register at all. The only way I can get the system clipboard to work is to run the guest with the full GUI and a native terminal app open in the GUI. – StevieD May 01 '17 at 23:33
  • You didn't answer my question. What does :reg + give? On my machine :reg + shows the * register, which is why you don't see + in the full :reg command. – Tumbler41 May 01 '17 at 23:38
  • It doesn't show anything. It doesn't exist. – StevieD May 01 '17 at 23:45
  • You say "terminal" window in the question. Can you use the clipboard from the terminal itself? e.g. with xclip or xsel? Also, it is very strange that :echom has("clipboard") gives 1 and :reg + fails (it should be the same code). What does vim --version actually say about the clipboard? – grochmal May 02 '17 at 01:22
  • Vim version reports +clipboard as well as +xterm_clipboard. I tried a solution using xclip and xsel but I could not get it working. The mapped vim command to xclip seemed to work (though I couldn't tell for sure) but when I went to paste I got some error about it not being able to locate a window, iirc. – StevieD May 02 '17 at 03:12
  • I cannot copy and paste with the mouse but it's not surprising since I'm running a guest machine through an ssh session. – StevieD May 02 '17 at 03:14
  • If you are still looking for it, here is my answer in Stackoverflow How to copy to clipboard in Vim? – Hoanh An Jan 17 '18 at 03:01

0 Answers0