Allow use of cd to positions in dirstack for zsh
man zshbuiltins excerpt: The third form of cd extracts an entry from the directory stack, and changes to that directory. An argument of the form `+n' identifies a stack entry by counting from the left of the list shown by the dirs com‐ mand, starting with zero. An argument of the form `-n' counts from the right. If the PUSHD_MINUS option is set, the meanings of `+' and `-' in this context are swapped. If the POSIX_CD option is set, this form of cd is not recognised and will be interpreted as the first form.
This commit is contained in:
parent
209d86ab2f
commit
bd3a4db8e5
|
|
@ -67,7 +67,7 @@ function __zoxide_z() {
|
|||
\builtin printf 'zoxide: $OLDPWD is not set'
|
||||
return 1
|
||||
fi
|
||||
elif [[ "$#" -eq 1 ]] && [[ -d "$1" ]]; then
|
||||
elif [[ "$#" -eq 1 ]] && [[ -d "$1" ]] || [[ "$1" =~ ^[-+][1-9]$ ]]; then
|
||||
__zoxide_cd "$1"
|
||||
elif [[ "$@[-1]" == "${__zoxide_z_prefix}"* ]]; then
|
||||
# shellcheck disable=SC2124
|
||||
|
|
|
|||
Loading…
Reference in New Issue