What the title says. I can think of some hackish ways to do it, but is there a correct way to do this?
To check for Windows, most scripts I have seen use the following:
let s:win = has("win16") || has("win32") || has("win64")
If none of these are defined, then it is a non-windows system and you can try the uname
suggestion by Martín Fixman.
If you are sure you will use Unix-like operating system, you can use
let os = substitute(system('uname'), "\n", "", "")
if os == "SunOS"
" Do Sun-specific stuff.
...
elseif os == "Linux"
" Do Linux-specific stuff.
...
endif
You can anyway use the has() command to check if some feature is supported, for more information look
:help has()
has('gui_macvim') has('gui_gtk2') has('gui_gtk') has('gui_win32')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With