1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-05-19 22:46:03 +02:00

moved from ./Functions/Misc/cdmatch

This commit is contained in:
Sven Wischnowsky 2001-04-02 12:24:29 +00:00
parent e40d5f133f
commit 716227e5e5

23
Functions/Compctl/cdmatch Normal file
View File

@ -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.