 Get running OSlet os = if has(win32)  let os=winelse  if has(unix)    let s:uname = system(uname)    if s:uname == Darwin      let os=mac    else      let os=unix    endif  endifendif Brackets expandinglet preBracket=`if os==mac  let preBracket=$endifexe 'vnoremap' . preBracket . '1 <esc>`>a)<esc>`<i(<esc>'exe 'vnoremap' . preBracket . '2 <esc>`>a]<esc>`<i[<esc>'exe 'vnoremap' . preBracket . '3 <esc>`>a}<esc>`<i{<esc>'exe 'vnoremap' . preBracket . '$ <esc>`>a<esc>`<i<esc>'exe 'vnoremap' . preBracket . 'q <esc>`>a''<esc>`<i''<esc>'exe 'vnoremap' . preBracket . 'e <esc>`>a<esc>`<i<esc>' Map auto complete of (, , ', [exe 'inoremap ' . preBracket . '1 ()<esc>i'exe 'inoremap ' . preBracket . '2 []<esc>i'exe 'inoremap ' . preBracket . '3 {}<esc>i'exe 'inoremap ' . preBracket . '4 {<esc>o}<esc>O'exe 'inoremap ' . preBracket . 'q ''''<esc>i'exe 'inoremap ' . preBracket . 'e <esc>i'As vimscript above I want to map the shortcut to key expand bracket depend on vim's platform. Actually my macbook use different layout but I love the ease of using ``` character in keyboard so I map to $ which stays at the same place on mac pro keyboard (da layout).But it seems that the script works fine on linux but doesn't work on mac. Did I miss something or I need to add something to make this script work on Mac OSX ?
Vim script check running platform
vim;osx;macintosh
i manage to answer my own question, for comparing string in vimscript we should use =~ instead of == . The reverse one is !~So edit this line if s:uname == Darwin to if s:uname =~ Darwin to make this little script work.I rewrite this as function:function! GetRunningOS()  if has(win32)    return win  endif  if has(unix)    if system('uname')=~'Darwin'      return mac    else      return linux    endif  endifendfunctionlet os=GetRunningOS()I hope this helps someone. In case, someone interest in my .vimrc, check my dotFiles