Skip to content

Commit

Permalink
add cygwin detection (include cygwin, msys2 and gitbash)
Browse files Browse the repository at this point in the history
  • Loading branch information
rwxguo committed Dec 24, 2023
1 parent bb17f91 commit e6a48de
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
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() || system('uname') =~ 'MINGW' || system('uname') =~ 'CYGWIN'
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
11 changes: 11 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

0 comments on commit e6a48de

Please sign in to comment.