diff --git a/share/functions/help.fish b/share/functions/help.fish index b06fbd42c..2e027541d 100644 --- a/share/functions/help.fish +++ b/share/functions/help.fish @@ -80,7 +80,7 @@ function help --description 'Show help for the fish shell' # We use this instead of xdg-open because that's useless without a backend # like wsl-open which we'll check in a minute. if test -f /proc/version - and string match -riq 'Microsoft|WSL' ' >$tmpname set page_url file://$tmpname - # For Windows (Cygwin and WSL), we need to convert the base help dir to a Windows path before converting it to a file URL + # For Windows (Cygwin, msys2 and WSL), we need to convert the base help dir to a Windows path before converting it to a file URL # but only if a Windows browser is being used if type -q cygpath - and string match -qr cygstart $fish_browser[1] + and string match -qr '(cygstart|\.exe)(\s+|$)' $fish_browser[1] set page_url file://(cygpath -m $tmpname) else if type -q wslpath - and string match -qr '.exe' $fish_browser[1] + and string match -qr '\.exe(\s+|$)' $fish_browser[1] set page_url file://(wslpath -w $tmpname) end end end # cmd.exe needs more coaxing. - if string match -qr 'cmd.exe$' -- $fish_browser[1] - $fish_browser /c "start $page_url" - # If browser is known to be graphical, put into background + if string match -qr 'cmd\.exe$' -- $fish_browser[1] + # The space before the /c is to prevent msys2 from expanding it to a path + $fish_browser " /c" start $page_url + # If browser is known to be graphical, put into background else if contains -- $fish_browser[1] $graphical_browsers switch $fish_browser[1] case htmlview x-www-browser @@ -193,7 +194,7 @@ function help --description 'Show help for the fish shell' else # Work around lynx bug where
always has the same formatting as links (unreadable) # by using a custom style sheet. See https://github.com/fish-shell/fish-shell/issues/4170 - if string match -q 'lynx*' -- $fish_browser + if string match -qr '^lynx' -- $fish_browser set fish_browser $fish_browser -lss={$__fish_data_dir}/lynx.lss end $fish_browser $page_url