Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
\ )
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