Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my .vimrc, I want to check if I'm in MacVim vs. regular vim so I can optionally set some MacVim-specific settings, which should not be applied to regular vim.

How do I do this?

share|improve this question
up vote 22 down vote accepted

I just found one way to do it:

if has("gui_macvim")
    " set macvim specific stuff
share|improve this answer
has("gui_running") will get you support for both macvim and gvim so will make your .vimrc more portable. – Bala Clark Mar 2 at 11:36
I noticed this condition is true either if I run macvim in terminal or GUI app. I is a way to check wether macvim is running in terminal? – May 16 at 7:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.