Mac – Sharing mac clipboard with vim inside terminal

macvimterminal

I use vim inside terminal and trying to share the mac clipboard with vim.

Compiled vim with xterm_clipboard support and installed XQuartz.

MacBook-Air:web-ui nagakirank$ vim --version | grep xterm_clipboard
+xsmp_interact +xterm_clipboard -xterm_save

Nagas-MacBook-Air:web-ui nagakirank$ echo $DISPLAY
/tmp/launch-ltuLWk/org.macosforge.xquartz:0

But,am not able to get Mac clipboard content inside vim using "+" register "+y.

Now,clueless on why it's not working..Need pointers on how to debug this?

Best Answer

Try building Vim 7.3 with the clipboard feature enabled. Starting in Vim 7.3, +clipboard uses the OS X pasteboard directly (via the * or + register, as you expected).

It probably is possible to use +xterm_clipboard with an X server configured to convert X’s selection to and from the OS X pasteboard, but it would probably be more problematic than the direct +clipboard solution.


As an example, the MacPorts build of the vim port that I have currently installed (vim @7.3.661_0+huge+perl+python27+ruby+tcl) has +clipboard, -xterm_clipboard, and can access the pasteboard through * and +.

Also, if you happen to be running Vim inside tmux you will probably need my wrapper program to reenable pasteboard access inside tmux sessions; this only applies to +clipboard access: X-mediated access might still work OK—as long as you keep DISPLAY updated—but still seems unnecessarily cumbersome to me.