home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Shells / zsh-3.0.5-MIHS / src / Functions / cdmatch < prev    next >
Encoding:
Text File  |  1997-06-03  |  709 b   |  24 lines

  1. # Start of cdmatch.
  2. # Save in your functions directory and autoload, then do
  3. # compctl -x 'S[/][~][./][../]' -g '*(-/)' - \
  4. #         'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd
  5. #
  6. # Completes directories for cd, pushd, ... anything which knows about cdpath.
  7. # You do not have to include `.' in your cdpath.
  8. #
  9. # It works properly only if $ZSH_VERSION > 3.0-pre4.  Remove `emulate -R zsh'
  10. # for all other values of $ZSH_VERSION > 2.6-beta2. For earlier versions
  11. # it still works if RC_EXPAND_PARAM is not set or when cdpath is empty.
  12. emulate -R zsh
  13. setopt localoptions
  14. local narg pref cdp
  15.  
  16. read -nc narg
  17. read -Ac pref
  18.  
  19. cdp=(. $cdpath)
  20. reply=( ${^cdp}/${pref[$narg]%$2}*$2(-/DN^M:t) )
  21.  
  22. return
  23. # End of cdmatch.
  24.