From d655e026f512c5277ad9a9edff9635764a97447a Mon Sep 17 00:00:00 2001 From: Han Li Date: Sat, 20 Jul 2024 13:19:43 +0800 Subject: [PATCH] Support `z -- dir` for zsh and fish (#858) --- templates/fish.txt | 2 ++ templates/zsh.txt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/templates/fish.txt b/templates/fish.txt index 9ab4983..4882280 100644 --- a/templates/fish.txt +++ b/templates/fish.txt @@ -82,6 +82,8 @@ function __zoxide_z __zoxide_cd - else if test $argc -eq 1 -a -d $argv[1] __zoxide_cd $argv[1] + else if test $argc -eq 2 -a $argv[1] = -- + __zoxide_cd -- $argv[2] else if set -l result (string replace --regex -- $__zoxide_z_prefix_regex '' $argv[-1]); and test -n $result __zoxide_cd $result else diff --git a/templates/zsh.txt b/templates/zsh.txt index a8f7349..a2d9542 100644 --- a/templates/zsh.txt +++ b/templates/zsh.txt @@ -59,6 +59,8 @@ function __zoxide_z() { __zoxide_cd ~ elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]$ ]]; }; then __zoxide_cd "$1" + elif [[ "$#" -eq 2 ]] && [[ "$1" = "--" ]]; then + __zoxide_cd "$2" else \builtin local result # shellcheck disable=SC2312