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?

Andy White
  • 1,161
  • 1
  • 14
  • 19

1 Answers1

41

I just found one way to do it:

if has("gui_macvim")
    " set macvim specific stuff
endif
Andy White
  • 1,161
  • 1
  • 14
  • 19
  • 4
    `has("gui_running")` will get you support for both macvim and gvim so will make your .vimrc more portable. – Bala Clark Mar 02 '16 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? – Seb Wilgosz May 16 '16 at 07: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 '19 at 02:19