Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In vim with

 :echo has('unix')

I can find out if the OS is Unix. How I can get more specific information about it? (Darwin, debian, etc)

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

Does has("macunix") do what you're looking for? You can take a look at :help has and :help feature-list for other options.

share|improve this answer
    
I prefer has("mac") –  juanpablo Sep 23 '11 at 18:43
add comment

Some of that information can be obtained from the uname command, e.g.,

$ uname -a

The name of the distribution is often found in /etc/issue:

$ head -1 /etc/issue

You can use the Vim system() function to execute those commands and return their outputs, e.g.,

let os = system('uname -o')
let dist = system('head -1 /etc/issue')

See

:help system()

Note that the return value of the system() function includes the trailing newline, so you'll need to remove it or take it into account when testing the return values. One way to remove it is this:

let os = substitute(os, '\n', '', 'g')
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.