File: cdmatch

package info (click to toggle)
zsh 3.1.2-8
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 3,628 kB
  • ctags: 3,582
  • sloc: ansic: 39,480; sh: 2,393; makefile: 1,189; perl: 329; awk: 257; sed: 25
file content (23 lines) | stat: -rwxr-xr-x 709 bytes parent folder | download | duplicates (23)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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.