Zsh: check directory existence using cd
This commit is contained in:
parent
d0a6843d2b
commit
63ef5518e2
|
|
@ -16,16 +16,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- `import` now skips directories matching `$_ZO_EXCLUDE_DIRS`.
|
||||
- POSIX: support for non-Cygwin Windows environments (e.g. Busybox).
|
||||
- Fish: Space-Tab completions now display and run the selected command.
|
||||
- Bash/POSIX: `z` now honors `$CDPATH`.
|
||||
- Bash/POSIX/Zsh: `z` now honors `$CDPATH`.
|
||||
|
||||
### Changed
|
||||
|
||||
- `import` now takes a subcommand instead of the `--from` flag.
|
||||
- `import` now auto-detects database files.
|
||||
- Nushell: export commands so the init script can be imported with `use`.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Bash/POSIX: `z` now handles relative paths through symlinked directories.
|
||||
- Bash/POSIX/Zsh: `z` now handles relative paths through symlinked directories.
|
||||
- Bash/Fish/POSIX/Zsh: `_ZO_RESOLVE_SYMLINKS` now works on Windows.
|
||||
- Bash: handle `$PROMPT_COMMAND` values ending in a semicolon.
|
||||
- PowerShell: navigate to home directory with `z` on drives that don't define `HOME`.
|
||||
|
|
|
|||
|
|
@ -89,7 +89,9 @@ function __zoxide_z() {
|
|||
__zoxide_doctor
|
||||
if [[ "$#" -eq 0 ]]; then
|
||||
__zoxide_cd ~
|
||||
elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]+$ ]]; }; then
|
||||
elif [[ "$#" -eq 1 ]] && [[ "$1" = '-' ]]; then
|
||||
__zoxide_cd "${OLDPWD}"
|
||||
elif [[ "$#" -eq 1 ]] && { [[ "$1" =~ ^[-+][0-9]+$ ]] || (\builtin cd -q -- "$1") &>/dev/null; }; then
|
||||
__zoxide_cd "$1"
|
||||
elif [[ "$#" -eq 2 ]] && [[ "$1" = "--" ]]; then
|
||||
__zoxide_cd "$2"
|
||||
|
|
|
|||
Loading…
Reference in New Issue