diff --git a/lib/functions.zsh b/lib/functions.zsh index f5c671f9c..efcaf1508 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -15,6 +15,8 @@ function upgrade_oh_my_zsh() { function open_command() { local open_cmd + local args=("$@") + [ "${#args[@]}" = 0 ] && args=("$PWD") # define the open command case "$OSTYPE" in @@ -32,12 +34,12 @@ function open_command() { # If a URL is passed, $BROWSER might be set to a local browser within SSH. # See https://github.com/ohmyzsh/ohmyzsh/issues/11098 - if [[ -n "$BROWSER" && "$1" = (http|https)://* ]]; then - "$BROWSER" "$@" + if [[ -n "$BROWSER" && "${args[@]}" = (http|https)://* ]]; then + "$BROWSER" "$args" return fi - ${=open_cmd} "$@" &>/dev/null + ${=open_cmd} "${args[@]}" &>/dev/null } # take functions diff --git a/plugins/macos/macos.plugin.zsh b/plugins/macos/macos.plugin.zsh index a4347005e..fc0976d5d 100644 --- a/plugins/macos/macos.plugin.zsh +++ b/plugins/macos/macos.plugin.zsh @@ -4,7 +4,7 @@ 0="${${(M)0:#/*}:-$PWD/$0}" # Open the current directory in a Finder window -alias ofd='open_command $PWD' +alias ofd='open_command' # Show/hide hidden files in the Finder alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"