File: cdmatch2

package info (click to toggle)
zsh-beta 4.3.0-dev-1%2B20050424-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 18,240 kB
  • ctags: 6,564
  • sloc: ansic: 79,241; sh: 4,874; perl: 748; makefile: 676; awk: 341; sed: 16
file content (15 lines) | stat: -rw-r--r-- 391 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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