Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mingw: Add platform checking of GoDocBrowser for Cygwin on windows #3611

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions autoload/go/config.vim
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ endfunction
function! go#config#PlayBrowserCommand() abort
if go#util#IsWin()
let go_play_browser_command = '!start rundll32 url.dll,FileProtocolHandler %URL%'
elseif go#util#IsCygwin()
let go_play_browser_command = '!rundll32 url.dll,FileProtocolHandler %URL%'
elseif go#util#IsMac()
let go_play_browser_command = 'open %URL%'
elseif executable('xdg-open')
Expand Down
6 changes: 6 additions & 0 deletions autoload/go/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ function! go#util#IsMac() abort
\ go#util#Exec(['uname'])[0] =~? '^darwin'
endfunction

" IsCygwin returns 1 if current OS is Cygwin/MSYS2/GitBash, 0 otherwise
function! go#util#IsCygwin()
return has('win32unix')
endfunction

" Checks if using:
" 1) Windows system,
" 2) And has cygpath executable,
Expand Down Expand Up @@ -529,6 +534,7 @@ function! go#util#OpenBrowser(url) abort
if l:cmd =~ '^!'
let l:cmd = substitute(l:cmd, '%URL%', '\=escape(shellescape(a:url), "#")', 'g')
silent! exec l:cmd
redraw!
elseif cmd =~ '^:[A-Z]'
let l:cmd = substitute(l:cmd, '%URL%', '\=escape(a:url,"#")', 'g')
exec l:cmd
Expand Down
Loading