how do I detect OS X in my .vimrc file, so certain configurations will only apply to OS X?

Posted by Brandon on Stack Overflow See other posts from Stack Overflow or by Brandon
Published on 2010-05-15T23:24:34Z Indexed on 2010/05/15 23:30 UTC
Read the original article Hit count: 263

Filed under:
|
|

I use my .vimrc file on my laptop (OS X) and several servers (Solaris & Linux), and could hypothetically someday use it on a Windows box. I know how to detect unix generally, and windows, but how do I detect OS X? (And for that matter, is there a way to distinguish between Linux and Solaris, etc. And is there a list somewhere of all the strings that 'has' can take? My Google-fu turned up nothing.)

For instance, I'd use something like this:

if has("mac")
  " open a file in TextMate from vi: "
  nmap mate :w<CR>:!mate %<CR>
elseif has("unix")
  " do stuff under linux and "
elseif has("win32")
  " do stuff under windows "
endif

But clearly "mac" is not the right string, nor are any of the others I tried.

© Stack Overflow or respective owner

Related posts about vim

Related posts about osx