From 8c07f6f47a0977b4dc733a5c25be42a6d1dda93b Mon Sep 17 00:00:00 2001 From: rwxguo <10892928+rwxguo@users.noreply.github.com> Date: Thu, 14 Dec 2023 18:00:27 +0800 Subject: [PATCH 01/11] update --- autoload/go/util.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoload/go/util.vim b/autoload/go/util.vim index 3a12f013a1..9ae5e1cd35 100644 --- a/autoload/go/util.vim +++ b/autoload/go/util.vim @@ -37,8 +37,9 @@ endfunction " IsWin returns 1 if current OS is Windows or 0 otherwise " Note that has('win32') is always 1 when has('win64') is 1, so has('win32') is enough. +" has('win32unix') for GitBash (MSYS2, Cygwin) function! go#util#IsWin() abort - return has('win32') + return has('win32') || has('win32unix') endfunction " IsMac returns 1 if current OS is macOS or 0 otherwise. From ba8f4315486b2504d8498b6e4d57a744d7ed6230 Mon Sep 17 00:00:00 2001 From: rwxguo <10892928+rwxguo@users.noreply.github.com> Date: Fri, 15 Dec 2023 11:29:22 +0800 Subject: [PATCH 02/11] update --- autoload/go/util.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/go/util.vim b/autoload/go/util.vim index 9ae5e1cd35..909660102f 100644 --- a/autoload/go/util.vim +++ b/autoload/go/util.vim @@ -37,7 +37,7 @@ endfunction " IsWin returns 1 if current OS is Windows or 0 otherwise " Note that has('win32') is always 1 when has('win64') is 1, so has('win32') is enough. -" has('win32unix') for GitBash (MSYS2, Cygwin) +" has('win32unix') for Cygwin (MSYS2, GitBash etc.) function! go#util#IsWin() abort return has('win32') || has('win32unix') endfunction From a3b82af6880bc09953c453cc58a28e265de8a34a Mon Sep 17 00:00:00 2001 From: rwxguo <10892928+rwxguo@users.noreply.github.com> Date: Fri, 15 Dec 2023 17:24:34 +0800 Subject: [PATCH 03/11] update --- autoload/go/config.vim | 2 +- autoload/go/util.vim | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/autoload/go/config.vim b/autoload/go/config.vim index ea51f0d78a..1756f3535e 100644 --- a/autoload/go/config.vim +++ b/autoload/go/config.vim @@ -100,7 +100,7 @@ function! go#config#SnippetEngine() abort endfunction function! go#config#PlayBrowserCommand() abort - if go#util#IsWin() + if go#util#IsWin() || system('uname') =~ 'MINGW' let go_play_browser_command = '!start rundll32 url.dll,FileProtocolHandler %URL%' elseif go#util#IsMac() let go_play_browser_command = 'open %URL%' diff --git a/autoload/go/util.vim b/autoload/go/util.vim index 909660102f..3a12f013a1 100644 --- a/autoload/go/util.vim +++ b/autoload/go/util.vim @@ -37,9 +37,8 @@ endfunction " IsWin returns 1 if current OS is Windows or 0 otherwise " Note that has('win32') is always 1 when has('win64') is 1, so has('win32') is enough. -" has('win32unix') for Cygwin (MSYS2, GitBash etc.) function! go#util#IsWin() abort - return has('win32') || has('win32unix') + return has('win32') endfunction " IsMac returns 1 if current OS is macOS or 0 otherwise. From a8425898a1a8afad0efd17c28933c55dadde0a45 Mon Sep 17 00:00:00 2001 From: rwxguo <10892928+rwxguo@users.noreply.github.com> Date: Fri, 15 Dec 2023 17:26:44 +0800 Subject: [PATCH 04/11] update --- autoload/go/util.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/autoload/go/util.vim b/autoload/go/util.vim index 3a12f013a1..89b72733d4 100644 --- a/autoload/go/util.vim +++ b/autoload/go/util.vim @@ -529,6 +529,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 From bb17f911dd73ca2eeef9ab1aa3aeea0c23ec9119 Mon Sep 17 00:00:00 2001 From: rwxguo <10892928+rwxguo@users.noreply.github.com> Date: Sat, 16 Dec 2023 00:08:47 +0800 Subject: [PATCH 05/11] update --- autoload/go/config.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/go/config.vim b/autoload/go/config.vim index 1756f3535e..ef699a0593 100644 --- a/autoload/go/config.vim +++ b/autoload/go/config.vim @@ -100,7 +100,7 @@ function! go#config#SnippetEngine() abort endfunction function! go#config#PlayBrowserCommand() abort - if go#util#IsWin() || system('uname') =~ 'MINGW' + if go#util#IsWin() || system('uname') =~ 'MINGW' || system('uname') =~ 'CYGWIN' let go_play_browser_command = '!start rundll32 url.dll,FileProtocolHandler %URL%' elseif go#util#IsMac() let go_play_browser_command = 'open %URL%' From e6a48de652fd64820583c245eede0b242b6eb2bb Mon Sep 17 00:00:00 2001 From: rwxguo <10892928+rwxguo@users.noreply.github.com> Date: Sun, 24 Dec 2023 14:17:16 +0800 Subject: [PATCH 06/11] add cygwin detection (include cygwin, msys2 and gitbash) --- autoload/go/config.vim | 2 +- autoload/go/util.vim | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/autoload/go/config.vim b/autoload/go/config.vim index ef699a0593..91f16ff32c 100644 --- a/autoload/go/config.vim +++ b/autoload/go/config.vim @@ -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%' diff --git a/autoload/go/util.vim b/autoload/go/util.vim index 89b72733d4..3846a4664d 100644 --- a/autoload/go/util.vim +++ b/autoload/go/util.vim @@ -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, From 2e1c93c33b21b69cd5a12db8838981422879efb8 Mon Sep 17 00:00:00 2001 From: rwxguo <10892928+rwxguo@users.noreply.github.com> Date: Sun, 24 Dec 2023 15:23:21 +0800 Subject: [PATCH 07/11] removed unmae checks and win32 checks --- autoload/go/util.vim | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/autoload/go/util.vim b/autoload/go/util.vim index 3846a4664d..229a4ef3bf 100644 --- a/autoload/go/util.vim +++ b/autoload/go/util.vim @@ -51,13 +51,7 @@ 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' - \ ) + return has('win32unix') endfunction " Checks if using: From f14d1709525913bff85a62b92d78007b0dc70ec2 Mon Sep 17 00:00:00 2001 From: rwxguo <10892928+rwxguo@users.noreply.github.com> Date: Mon, 25 Dec 2023 13:04:01 +0000 Subject: [PATCH 08/11] use cygstart instead of start for cygwin rather than msys2 and gitbash --- autoload/go/config.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/autoload/go/config.vim b/autoload/go/config.vim index 91f16ff32c..c642ce0f8d 100644 --- a/autoload/go/config.vim +++ b/autoload/go/config.vim @@ -100,8 +100,15 @@ function! go#config#SnippetEngine() abort endfunction function! go#config#PlayBrowserCommand() abort - if go#util#IsWin() || go#util#IsCygwin() + if go#util#IsWin() let go_play_browser_command = '!start rundll32 url.dll,FileProtocolHandler %URL%' + elseif go#util#IsCygwin() + " CYGWIN uses 'cygstart', whereas MSYS2 and GitBash uses 'start' + if system('uname') =~ 'CYGWIN' + let go_play_browser_command = '!cygstart rundll32 url.dll,FileProtoco lHandler %URL%' + else + let go_play_browser_command = '!start rundll32 url.dll,FileProtocolHa ndler %URL%' + endif elseif go#util#IsMac() let go_play_browser_command = 'open %URL%' elseif executable('xdg-open') From ac13737fe1c75308b21b98da3c92410b73ce13b5 Mon Sep 17 00:00:00 2001 From: rwxguo <10892928+rwxguo@users.noreply.github.com> Date: Mon, 25 Dec 2023 13:12:25 +0000 Subject: [PATCH 09/11] update --- autoload/go/config.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/autoload/go/config.vim b/autoload/go/config.vim index c642ce0f8d..a337428338 100644 --- a/autoload/go/config.vim +++ b/autoload/go/config.vim @@ -103,8 +103,7 @@ function! go#config#PlayBrowserCommand() abort if go#util#IsWin() let go_play_browser_command = '!start rundll32 url.dll,FileProtocolHandler %URL%' elseif go#util#IsCygwin() - " CYGWIN uses 'cygstart', whereas MSYS2 and GitBash uses 'start' - if system('uname') =~ 'CYGWIN' + if executable('cygstart') let go_play_browser_command = '!cygstart rundll32 url.dll,FileProtoco lHandler %URL%' else let go_play_browser_command = '!start rundll32 url.dll,FileProtocolHa ndler %URL%' From 2060e8fac0203f577e2304ccc85e8373fd2bcb7a Mon Sep 17 00:00:00 2001 From: rwxguo <10892928+rwxguo@users.noreply.github.com> Date: Mon, 25 Dec 2023 13:29:16 +0000 Subject: [PATCH 10/11] update --- autoload/go/config.vim | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/autoload/go/config.vim b/autoload/go/config.vim index a337428338..33fd016e52 100644 --- a/autoload/go/config.vim +++ b/autoload/go/config.vim @@ -103,11 +103,7 @@ function! go#config#PlayBrowserCommand() abort if go#util#IsWin() let go_play_browser_command = '!start rundll32 url.dll,FileProtocolHandler %URL%' elseif go#util#IsCygwin() - if executable('cygstart') - let go_play_browser_command = '!cygstart rundll32 url.dll,FileProtoco lHandler %URL%' - else - let go_play_browser_command = '!start rundll32 url.dll,FileProtocolHa ndler %URL%' - endif + let go_play_browser_command = '!rundll32 url.dll,FileProtocolHa ndler %URL%' elseif go#util#IsMac() let go_play_browser_command = 'open %URL%' elseif executable('xdg-open') From 80ca0ee298fe7bcdea2959c1d5ff5a02371de808 Mon Sep 17 00:00:00 2001 From: rwxguo <10892928+rwxguo@users.noreply.github.com> Date: Mon, 25 Dec 2023 13:30:29 +0000 Subject: [PATCH 11/11] update --- autoload/go/config.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/go/config.vim b/autoload/go/config.vim index 33fd016e52..231c666995 100644 --- a/autoload/go/config.vim +++ b/autoload/go/config.vim @@ -103,7 +103,7 @@ 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,FileProtocolHa ndler %URL%' + 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')