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.