11

I run linux via VirtualBox on OS X where I edit in vim. I do this by running my VM in a headless state and then sshing to the linux machine using port forwarding. Is there any way to yank text in visual mode so that what's yanked is put into my local clipboard?

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
Leeren
  • 1,931
  • 2
  • 20
  • 31

1 Answers1

9

Make sure that (1) your Vims on both sides are compiled with +xterm_clipboard, and (2) you have X11 forwarding enabled through ssh. Then set clipboard to unnamedplus,autoselect in your vimrcs on both sides:

set clipboard=unnamedplus,autoselect,exclude:cons\\\\|linux

With this you should be able to yank text from a Vim on the guest and paste it to a Vim on the host, and the other way around, provided that the two Vims are running at the same time and the ssh connection is still open.

lcd047
  • 5,731
  • 2
  • 28
  • 38
  • 1
    You can compile VIM with `+xterm_clipboard` easily with the solution posted here: http://stackoverflow.com/questions/10101488/cut-to-the-system-clipboard-from-vim-on-ubuntu – Cloud Jul 10 '15 at 20:56