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: 1 addition & 1 deletion autoload/go/config.vim
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function! go#config#SnippetEngine() abort
endfunction

function! go#config#PlayBrowserCommand() abort
if go#util#IsWin()
if go#util#IsWin() || go#util#IsCygwin()
let go_play_browser_command = '!start rundll32 url.dll,FileProtocolHandler %URL%'
elseif go#util#IsMac()
let go_play_browser_command = 'open %URL%'
Expand Down
12 changes: 12 additions & 0 deletions autoload/go/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ 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('win32') &&
\ has('win32unix') &&
\ (
\ system('uname') =~ 'CYGWIN' ||
\ system('uname') =~ 'MINGW' ||
\ system('uname') =~ 'MSYS'
\ )
rwxguo marked this conversation as resolved.
Show resolved Hide resolved
endfunction

" Checks if using:
" 1) Windows system,
" 2) And has cygpath executable,
Expand Down Expand Up @@ -529,6 +540,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