From daa5f384b2cabd4b6fcc027857e92d1ae83ec76e Mon Sep 17 00:00:00 2001 From: salarkhannn Date: Tue, 30 Jun 2026 16:55:12 +0500 Subject: [PATCH] fix(zsh): detect relative paths through symlinks as directories When cwd is a symlink, [[ -d ../foo ]] follows the symlink before resolving .., so the check fails even though cd ../foo would succeed via the shell's logical path tracking. Allow paths containing .. through to __zoxide_cd, which relies on the shell's native cd behavior. Fixes #1166 --- templates/zsh.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/zsh.txt b/templates/zsh.txt index 9cdbcc2..f4d15c4 100644 --- a/templates/zsh.txt +++ b/templates/zsh.txt @@ -89,7 +89,7 @@ function __zoxide_z() { __zoxide_doctor if [[ "$#" -eq 0 ]]; then __zoxide_cd ~ - elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]+$ ]]; }; then + elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = *..* ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]+$ ]]; }; then __zoxide_cd "$1" elif [[ "$#" -eq 2 ]] && [[ "$1" = "--" ]]; then __zoxide_cd "$2"