32

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?

1 Answer 1

41

I just found one way to do it:

if has("gui_macvim")
    " set macvim specific stuff
endif
3
  • 4
    has("gui_running") will get you support for both macvim and gvim so will make your .vimrc more portable.
    – Bala Clark
    Mar 2, 2016 at 11:36
  • 2
    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, 2016 at 7:57
  • 1
    For MacVim it looks like has("gui_macvim") returns true if it is running as a GUI or on the commandline. However has("gui_running") only seems to return true if MacVim is running as a GUI.
    – Von
    Dec 27, 2019 at 2:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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