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.

2
  • Out of curiosity, what plugin do you use that requires +X11?
    – romainl
    Commented Jan 27, 2015 at 10:13
  • Vim-r-plugin requires it for certain setups
    – Jeff
    Commented Jan 27, 2015 at 13:45

1 Answer 1

6
if has("x11")
   echo "yep"
endif
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .