I think that's how it's meant to work. I think you have to do
has('gui_running')
to test whether it's running.
Yes. I'm right. See
:help feature-list
where it explains that 'gui' means GUI is compiled in and 'gui_running' is for if
the GUI is running, or is about to be.
Perhaps on Linux the 'vim' in your path is actually a different executable, e.g. a
vim-tiny without GUI compiled in.
Ben.
On my Ubuntu box (with vim-full), :echo has("gui") returns 1 always
(terminal or X11). :echo has("gui_running") returns 0 in the terminal,
and 1 in X11. On Mac OS X with MacVim, :echo has("gui") and :echo
has("gui_running") seem to have the same behavior. Are you actually
seeing something different?
(One thing that might get around all of this is to put the gui only
stuff in your .gvimrc, and then you shouldn't need to do a if
has("gui_running") at all.)
It does work the same way as in Linux, AFAICT. If you are seeing different
behaviour, I don't think it's because of the program itself, but something in your
configuration (e.g. different binaries being run; perhaps check the :version
output is the same for both GUI and non-GUI; that has the potential to give away a
difference!).
Ben.