4

I have two copies of vim installed.

One is installed with macvim and necessarily configured with -X11 (to work with Cocoa), while the other is configured to +X11 (used in terminal, to work with a plugin I use)

I would like all yanks to go to the system clipboard. When +X11 is enabled, I can do this in .vimrc with set clipboard=unnamedplus. When -X11, I can do it with set clipboard=unnamed.

How can I do this in .vimrc conditionally?

Something like

if &x11
 set clipboard=unnamedplus
else
 set clipboard=unnamed
endif

Of course this doesn't work because &x11 is not a real variable.

Jeff
  • 642

1 Answers1

6
if has("x11")
   echo "yep"
endif
akira
  • 63,447