Invoke :Browse if available to open URL

Example that invokes open(1) on OS X:

    command! -bar -nargs=1 Browse silent! !open <args>

Closes #509.
This commit is contained in:
Tim Pope
2014-06-26 17:07:07 -04:00
parent fdc8569c18
commit 32957cb552

View File

@@ -2147,6 +2147,8 @@ function! s:Browse(bang,line1,count,...) abort
if a:bang
let @* = url
return 'echomsg '.string(url)
elseif exists(':Browse') == 2
return 'echomsg '.string(url).'|Browse '.string(url)
else
return 'echomsg '.string(url).'|call netrw#NetrwBrowseX('.string(url).', 0)'
endif