qweruiop
qweruiop

Reputation: 3266

How to enable YCM for MacVim only (while keep it disabled for terminal Vim)

I've been using Vim for a while but still get confused by configuration. I want to config my Vim in such a way that YCM (YouCompleteMe, an auto-complete plugin) only gets loaded if running in GUI mode (e.g. MacVim), while if terminal Vim (maybe misnomer, I mean text-based Vim launched from command line) runs, YCM won't be loaded.

This question actually can be generalized to "How to selectively load plugins depending on running mode?". I though it must has been considered elsewhere, but Google gets me little useful information.

Upvotes: 1

Views: 354

Answers (2)

Lithis
Lithis

Reputation: 1377

Put your GUI-only configuration in the file .gvimrc.

Console Vim sources .vimrc when it starts. GUI Vim sources .vimrc and then .gvimrc, so settings in .gvimrc can override settings in .vimrc. For more information, see :help gui-start.

Upvotes: 0

VanLaser
VanLaser

Reputation: 1164

if has("gui_running")
    ... enable gui stuff here
else
    ... enable terminal stuff here
endif

(see h: feature-list)

Upvotes: 2

Related Questions