mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-17 10:20:55 +01:00
moved from ./Functions/Misc/cdmatch2
This commit is contained in:
parent
d3a4878b68
commit
a809e1548b
1 changed files with 15 additions and 0 deletions
15
Functions/Compctl/cdmatch2
Normal file
15
Functions/Compctl/cdmatch2
Normal file
|
@ -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 extendedglob
|
||||
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
|
Loading…
Reference in a new issue