diff --git a/lib/functions.zsh b/lib/functions.zsh index f448dbce8..dd8311611 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -22,9 +22,10 @@ function open_command() { case "$OSTYPE" in darwin*) open_cmd='open' ;; cygwin*) open_cmd='cygstart' ;; - linux*) [[ $(uname -a) =~ "Microsoft" ]] && \ - open_cmd='cmd.exe /c start' || \ - open_cmd='xdg-open' ;; + linux*) ! [[ $(uname -a) =~ "Microsoft" ]] && open_cmd='xdg-open' || { + open_cmd='cmd.exe /c start ""' + [[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 } + } ;; msys*) open_cmd='start ""' ;; *) echo "Platform $OSTYPE not supported" return 1