mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-13 03:01:32 +01:00
ofd: better version of the fix
This commit is contained in:
parent
a441fd6e0e
commit
24401b114a
2 changed files with 6 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue