mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2024-11-22 12:55:13 +00:00
zsh: allow z
to navigate dirstack via +n
and -n
This commit is contained in:
parent
209d86ab2f
commit
1306fba4ac
@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Changed
|
||||
|
||||
- Fish: change fuzzy completion prefix to `z!`.
|
||||
- Zsh: allow `z` to navigate dirstack via `+n` and `-n`.
|
||||
|
||||
## [0.8.2] - 2022-06-26
|
||||
|
||||
|
@ -19,7 +19,7 @@ function __zoxide_pwd() {
|
||||
# cd + custom logic based on the value of _ZO_ECHO.
|
||||
function __zoxide_cd() {
|
||||
# shellcheck disable=SC2164
|
||||
\builtin cd -- "$@" {%- if echo %} && __zoxide_pwd {%- endif %}
|
||||
\builtin cd -- "$@" >/dev/null {%- if echo %} && __zoxide_pwd {%- endif %}
|
||||
}
|
||||
|
||||
{{ section }}
|
||||
@ -59,15 +59,7 @@ function __zoxide_z() {
|
||||
# shellcheck disable=SC2199
|
||||
if [[ "$#" -eq 0 ]]; then
|
||||
__zoxide_cd ~
|
||||
elif [[ "$#" -eq 1 ]] && [[ "$1" = '-' ]]; then
|
||||
if [[ -n "${OLDPWD}" ]]; then
|
||||
__zoxide_cd "${OLDPWD}"
|
||||
else
|
||||
# shellcheck disable=SC2016
|
||||
\builtin printf 'zoxide: $OLDPWD is not set'
|
||||
return 1
|
||||
fi
|
||||
elif [[ "$#" -eq 1 ]] && [[ -d "$1" ]]; then
|
||||
elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]$ ]]; }; then
|
||||
__zoxide_cd "$1"
|
||||
elif [[ "$@[-1]" == "${__zoxide_z_prefix}"* ]]; then
|
||||
# shellcheck disable=SC2124
|
||||
|
Loading…
Reference in New Issue
Block a user