From cad4eb63d3c101a5a1c47ecffb00191e61621667 Mon Sep 17 00:00:00 2001 From: Martin Chen Date: Wed, 22 Apr 2026 15:22:14 +1000 Subject: [PATCH 1/3] Added . and .. cases --- templates/bash.txt | 4 ++++ templates/fish.txt | 2 ++ templates/posix.txt | 2 ++ templates/zsh.txt | 2 ++ 4 files changed, 10 insertions(+) diff --git a/templates/bash.txt b/templates/bash.txt index 068ebea..5e411ba 100644 --- a/templates/bash.txt +++ b/templates/bash.txt @@ -111,6 +111,10 @@ function __zoxide_z() { __zoxide_cd ~ elif [[ $# -eq 1 && $1 == '-' ]]; then __zoxide_cd "${OLDPWD}" + elif [[ $# -eq 1 && $1 == '~' ]]; then + __zoxide_cd ~ + elif [[ $# -eq 1 && ($1 == '.' || $1 == '..') ]]; then + __zoxide_cd "$1" elif [[ $# -eq 1 && -d $1 ]]; then __zoxide_cd "$1" elif [[ $# -eq 2 && $1 == '--' ]]; then diff --git a/templates/fish.txt b/templates/fish.txt index a13edc7..c18f25b 100644 --- a/templates/fish.txt +++ b/templates/fish.txt @@ -79,6 +79,8 @@ function __zoxide_z __zoxide_cd $HOME else if test "$argv" = - __zoxide_cd - + else if test $argc -eq 1 -a \( "$argv[1]" = '.' -o "$argv[1]" = '..' \) + __zoxide_cd $argv[1] else if test $argc -eq 1 -a -d $argv[1] __zoxide_cd $argv[1] else if test $argc -eq 2 -a $argv[1] = -- diff --git a/templates/posix.txt b/templates/posix.txt index b3f660c..3da30db 100644 --- a/templates/posix.txt +++ b/templates/posix.txt @@ -105,6 +105,8 @@ __zoxide_z() { \command printf 'zoxide: $OLDPWD is not set' return 1 fi + elif [ "$#" -eq 1 ] && [ "$1" = '.' -o "$1" = '..' ]; then + __zoxide_cd "$1" elif [ "$#" -eq 1 ] && [ -d "$1" ]; then __zoxide_cd "$1" else diff --git a/templates/zsh.txt b/templates/zsh.txt index a66f960..93d7694 100644 --- a/templates/zsh.txt +++ b/templates/zsh.txt @@ -88,6 +88,8 @@ function __zoxide_z() { __zoxide_doctor if [[ "$#" -eq 0 ]]; then __zoxide_cd ~ + elif [[ "$#" -eq 1 && ($1 == '.' || $1 == '..') ]]; then + __zoxide_cd "$1" elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]+$ ]]; }; then __zoxide_cd "$1" elif [[ "$#" -eq 2 ]] && [[ "$1" = "--" ]]; then From 5557548029e16952b0796651ffc8e8adf1503186 Mon Sep 17 00:00:00 2001 From: Martin Chen Date: Wed, 22 Apr 2026 15:27:12 +1000 Subject: [PATCH 2/3] Minor change to syntax --- templates/posix.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/posix.txt b/templates/posix.txt index 3da30db..5a3ba5b 100644 --- a/templates/posix.txt +++ b/templates/posix.txt @@ -105,7 +105,7 @@ __zoxide_z() { \command printf 'zoxide: $OLDPWD is not set' return 1 fi - elif [ "$#" -eq 1 ] && [ "$1" = '.' -o "$1" = '..' ]; then + elif [ "$#" -eq 1 ] && { [ "$1" = '.' ] || [ "$1" = '..' ]; }; then __zoxide_cd "$1" elif [ "$#" -eq 1 ] && [ -d "$1" ]; then __zoxide_cd "$1" From 0d16cf3998dd0218af0267d71673d88cfd834908 Mon Sep 17 00:00:00 2001 From: Peppr Date: Wed, 22 Apr 2026 18:05:36 +1000 Subject: [PATCH 3/3] Update templates/bash.txt Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- templates/bash.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/templates/bash.txt b/templates/bash.txt index 5e411ba..6878f3b 100644 --- a/templates/bash.txt +++ b/templates/bash.txt @@ -111,8 +111,6 @@ function __zoxide_z() { __zoxide_cd ~ elif [[ $# -eq 1 && $1 == '-' ]]; then __zoxide_cd "${OLDPWD}" - elif [[ $# -eq 1 && $1 == '~' ]]; then - __zoxide_cd ~ elif [[ $# -eq 1 && ($1 == '.' || $1 == '..') ]]; then __zoxide_cd "$1" elif [[ $# -eq 1 && -d $1 ]]; then