From cad4eb63d3c101a5a1c47ecffb00191e61621667 Mon Sep 17 00:00:00 2001 From: Martin Chen Date: Wed, 22 Apr 2026 15:22:14 +1000 Subject: [PATCH] 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