diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2012-08-21 18:45:31 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2012-08-21 18:45:31 +0000 |
commit | 76091a6995f7a567651232e2d164f6ea91462b05 (patch) | |
tree | b3bc5d1256fed8f73ea7372d4e1dfd13734f17be /Completion/Unix | |
parent | 6f3ff6b653ca5e6f528bc46ec6295cb6d263a9fd (diff) | |
download | zsh-76091a6995f7a567651232e2d164f6ea91462b05.tar.gz zsh-76091a6995f7a567651232e2d164f6ea91462b05.tar.xz zsh-76091a6995f7a567651232e2d164f6ea91462b05.zip |
users/17211: new recursive-files style
Diffstat (limited to 'Completion/Unix')
-rw-r--r-- | Completion/Unix/Type/_files | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files index f21d7bc3b..0a2715814 100644 --- a/Completion/Unix/Type/_files +++ b/Completion/Unix/Type/_files @@ -1,7 +1,7 @@ #compdef -redirect-,-default-,-default- local opts tmp glob pat pats expl tag i def descr end ign ret=1 match tried -local type sdef ignvars ignvar +local type sdef ignvars ignvar prepath oprefix rfiles rfile zparseopts -a opts \ '/=tmp' 'f=tmp' 'g+:-=tmp' q n 1 2 P: S: r: R: W: X+: M+: F: J+: V+: @@ -118,7 +118,21 @@ for def in "$pats[@]"; do while _next_label "$tag" expl "$descr"; do _comp_ignore=( $_comp_ignore $ign ) if [[ -n "$end" ]]; then - _path_files -g "$pat" "$opts[@]" "$expl[@]" && ret=0 + if _path_files -g "$pat" "$opts[@]" "$expl[@]"; then + ret=0 + elif [[ $PREFIX$SUFFIX != */* ]] && zstyle -a ":completion:${curcontext}:$tag" recursive-files rfiles; then + for rfile in $rfiles; do + if [[ $PWD/ = ${~rfile} ]]; then + for prepath in **/*(/); do + oprefix=$PREFIX + PREFIX=$prepath/$PREFIX + _path_files -g "$pat" "$opts[@]" "$expl[@]" && ret=0 + PREFIX=$oprefix + done + break + fi + done + fi else _path_files "$expl[@]" -g "$pat" "$opts[@]" && ret=0 fi |