Code Yarns ‍👨‍💻
Tech BlogPersonal 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


© 2026 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 Mastodon🦋 Bluesky📧 Email