Code Yarns β€πŸ‘¨β€πŸ’»
Tech Blog ❖ Personal Blog

How to check for Cygwin in Vim

πŸ“… 2013-Jul-26 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ cygwin, vim ⬩ πŸ“š Archive

Vimrc and other Vim script files can be used across many platforms. To check specifically for CygwinΒ in these files, check for win32unix as shown here:

if has("win32unix")
    " Do something only in Cygwin
endif

Note that value of unix is also true under Cygwin. So, if you want to do something specifically under Linux, but not under Cygwin, then try this:

if has("unix") && !has("win32unix")
    " Do something only in Linux, but not in Cygwin
endif

Tried with: Vim 7.3 and Cygwin 1.7.22


Β© 2022 Ashwin Nanjappa β€’ All writing under CC BY-SA license β€’ 🐘 @codeyarns@hachyderm.io β€’ πŸ“§