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 gene
I could not edit previous answer by adding two character only:
Here is correct one(passed on my macos 10.6 and default vim console version)
if has("unix")
let s:uname = system("uname")
if s:uname == "Darwin\n"
" Do Mac stuff here
endif
endif
system("uname") will come up with a return character, which makes second if condition failed. Just a small fix to add "\n".