1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-05-29 11:26:03 +02:00
zsh/Functions/cdmatch2

16 lines
378 B
Plaintext
Raw Normal View History

1999-04-15 20:05:35 +02:00
# 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