I have in my .vimrc:
fun! MySys()
if has('win16') || has('win32') || has('win64')
return "win"
endif
endfun
And in my .gvimrc:
if MySys() == "win"
autocmd GUIEnter * simalt ~ x " start maximized"
endif
For some reason, the autocmd is being called when I open macvim in a mac workstation. It shouldn’t because I’m on a mac and the autocmd is inside a win if.
What problem can this be?
The reason for this is that you’re doing a strange comparison.
The
MySys()function will return1if you’re on Windows and0if you’re not. You’re then comparing0to “win”, which (for reasons I don’t really understand) produces a match.How about changing to this:
(Untested)