summary refs log tree commit diff
path: root/Functions
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 12:24:29 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 12:24:29 +0000
commit716227e5e59bdc60d426ad5ad7d582e3060ff548 (patch)
treedcacb27d7848cd4c1367a7a1318f7d347dec5467 /Functions
parente40d5f133fc50e5f26a32064627aca8a551df939 (diff)
downloadzsh-716227e5e59bdc60d426ad5ad7d582e3060ff548.tar.gz
zsh-716227e5e59bdc60d426ad5ad7d582e3060ff548.tar.xz
zsh-716227e5e59bdc60d426ad5ad7d582e3060ff548.zip
moved from ./Functions/Misc/cdmatch
Diffstat (limited to 'Functions')
-rw-r--r--Functions/Compctl/cdmatch23
1 files changed, 23 insertions, 0 deletions
diff --git a/Functions/Compctl/cdmatch b/Functions/Compctl/cdmatch
new file mode 100644
index 000000000..7c4bb9ae7
--- /dev/null
+++ b/Functions/Compctl/cdmatch
@@ -0,0 +1,23 @@
+# Start of cdmatch.
+# Save in your functions directory and autoload, then do
+# compctl -x 'S[/][~][./][../]' -g '*(-/)' - \
+#         'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd
+#
+# Completes directories for cd, pushd, ... anything which knows about cdpath.
+# You do not have to include `.' in your cdpath.
+#
+# It works properly only if $ZSH_VERSION > 3.0-pre4.  Remove `emulate -R zsh'
+# for all other values of $ZSH_VERSION > 2.6-beta2. For earlier versions
+# it still works if RC_EXPAND_PARAM is not set or when cdpath is empty.
+emulate -R zsh
+setopt localoptions
+local narg pref cdp
+
+read -nc narg
+read -Ac pref
+
+cdp=(. $cdpath)
+reply=( ${^cdp}/${pref[$narg]%$2}*$2(-/DN^M:t) )
+
+return
+# End of cdmatch.