diff --git a/templates/bash.txt b/templates/bash.txt index aeec524f..7a9201f5 100644 --- a/templates/bash.txt +++ b/templates/bash.txt @@ -75,6 +75,8 @@ function __zoxide_z() { __zoxide_cd "${OLDPWD}" elif [[ $# -eq 1 && -d $1 ]]; then __zoxide_cd "$1" + elif [[ $# -eq 2 && -d $2 && $1 == '--' ]]; then + __zoxide_cd "$2" elif [[ ${@: -1} == "${__zoxide_z_prefix}"?* ]]; then # shellcheck disable=SC2124 \builtin local result="${@: -1}" diff --git a/templates/posix.txt b/templates/posix.txt index 1c039cd7..3b44a706 100644 --- a/templates/posix.txt +++ b/templates/posix.txt @@ -65,6 +65,8 @@ __zoxide_z() { fi elif [ "$#" -eq 1 ] && [ -d "$1" ]; then __zoxide_cd "$1" + elif [ "$#" -eq 2 ] && [ -d "$2" ] && [ "$1" = '--' ]; then + __zoxide_cd "$2" else __zoxide_result="$(\command zoxide query --exclude "$(__zoxide_pwd || \builtin true)" -- "$@")" && __zoxide_cd "${__zoxide_result}"