From c175751b501a3a4cb40ad4787340a597ea769be4 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Thu, 15 Apr 1999 18:05:35 +0000 Subject: Initial revision --- Functions/cdmatch2 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Functions/cdmatch2 (limited to 'Functions/cdmatch2') diff --git a/Functions/cdmatch2 b/Functions/cdmatch2 new file mode 100644 index 000000000..c70357a34 --- /dev/null +++ b/Functions/cdmatch2 @@ -0,0 +1,15 @@ +# This function should be called from compctl to complete the +# second argument of cd and pushd. + +emulate -R zsh # Requires zsh 3.0-pre4 or later +setopt localoptions +local from + +read -Ac from +from="${from[2]}" + +eval "reply=( \${PWD:s@$from@$1*$2@}~$PWD(ND-/:) )" +reply=( "${${reply[@]#${PWD%%$from*}}%${PWD#*$from}}" ) +[[ ${#reply[(r),-1]} != 0 ]] && reply[(r)]="''" + +return -- cgit 1.4.1