5bf7f9c83325a6cb2752e14ca01a574dbeef206e

Author
Marc Cornellà <hello@mcornella.com>
Committer
GitHub <noreply@github.com>
Date

Message

fix(lib): use `$BROWSER` in `open_command` if set (#11532)

Fixes #11098

Diff

 1diff --git a/lib/functions.zsh b/lib/functions.zsh
 2index 6e1faa6aa165a09549797ad7b23bd174480ce9b2..1d85ea38a82fdea1a637aa0c7021a68be6554c07 100644
 3--- a/lib/functions.zsh
 4+++ b/lib/functions.zsh
 5@@ -30,6 +30,13 @@ function open_command() {
 6               ;;
 7   esac
 8 
 9+  # If a URL is passed, $BROWSER might be set to a local browser within SSH.
10+  # See https://github.com/ohmyzsh/ohmyzsh/issues/11098
11+  if [[ -n "$BROWSER" && "$1" = (http|https)://* ]]; then
12+    "$BROWSER" "$@"
13+    return
14+  fi
15+
16   ${=open_cmd} "$@" &>/dev/null
17 }
18