vim - Vimscript: How can I get the Operating System version? -
even though it's similar this , this question need know current version of operating system while vim running. previous questions don't me since describe feature set of executable; need function return os version either name or number (e.g. listed in widows version chart).
is there one?
i don't know windows on mac os x can do:
$ sw_vers -productversion
and on ubuntu can do:
$ lsb_release -rs
this quick hack seems work, you'll have adapt needs:
function! getsysversion() let os=substitute(system('uname'), '\n', '', '') if os == 'darwin' || os == 'mac' let sys_version=substitute(system('sw_vers -productversion'), '\n', '', '') elseif os == 'linux' let sys_version=substitute(system('lsb_release -rs'), '\n', '', '') endif echo sys_version endfunction
Comments
Post a Comment