From 2afff4c411b5496a24e8f8698a4e01e5fc74d2df Mon Sep 17 00:00:00 2001 From: EinfachToll Date: Mon, 14 Sep 2015 15:11:14 +0200 Subject: [PATCH] Detect the OS correctly Fix #158 --- autoload/vimwiki/base.vim | 2 +- autoload/vimwiki/u.vim | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index cd5b99b..a350193 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -389,7 +389,7 @@ function! vimwiki#base#system_open_link(url) "{{{ if vimwiki#u#is_windows() call s:win32_handler(a:url) return - elseif has("macunix") + elseif vimwiki#u#is_macos() call s:macunix_handler(a:url) return else diff --git a/autoload/vimwiki/u.vim b/autoload/vimwiki/u.vim index cfe0f7a..51f35da 100644 --- a/autoload/vimwiki/u.vim +++ b/autoload/vimwiki/u.vim @@ -23,6 +23,15 @@ function! vimwiki#u#is_windows() "{{{ return has("win32") || has("win64") || has("win95") || has("win16") endfunction "}}} +function! vimwiki#u#is_macos() + if has("mac") || has("macunix") || has("gui_mac") + return 1 + endif + " that still doesn't mean we are not on Mac OS + let os = substitute(system('uname'), '\n', '', '') + return os == 'Darwin' || os == 'Mac' +endfunction + function! vimwiki#u#time(starttime) "{{{ " measure the elapsed time and cut away miliseconds and smaller return matchstr(reltimestr(reltime(a:starttime)),'\d\+\(\.\d\d\)\=')