1

How, from within vim (.vimrc), can I tell if I am running under Linux, AIX, Solaris, HP unix, etc...

It is easy to test if vim is running under Unix, Windows or Mac with:

if has("win32")
  <Windows specific configuration>
elseif has("mac")
  <Mac specific configuration>
else
  <Unix here running (assumed), but which platform?  Linux? AIX? ...>
fi

Ideally, I want a solution using vim builtin commands to avoid forking a process by calling an external command. But if it is not possible and an external process needs to be called, then so be it.

  • 3
    if system('uname') =~ 'linux' etc, you get the idea – Christian Brabandt Feb 27 '18 at 19:20

Browse other questions tagged or ask your own question.