diff options
Diffstat (limited to 'Completion/Base/Completer/_expand')
-rw-r--r-- | Completion/Base/Completer/_expand | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Completion/Base/Completer/_expand b/Completion/Base/Completer/_expand index 4835e4efc..8fcedea96 100644 --- a/Completion/Base/Completer/_expand +++ b/Completion/Base/Completer/_expand @@ -89,10 +89,16 @@ subd=("$exp[@]") [[ "$subd" = "$exp"(|\(N\)) ]] && return 1 zstyle -s ":completion:${curcontext}:" keep-prefix tmp || tmp=changed -if [[ "$word" = [\~\$]*/* && "$tmp" = (yes|true|on|1|changed) ]]; then - eval 'epre=( ${(e)~${word%%/*}} )' 2>/dev/null - if [[ -n "$epre" && $#epre -eq 1 ]]; then + +if [[ "$word" = (\~*/*|*\$*/*) && "$tmp" = (yes|true|on|1|changed) ]]; then + if [[ "$word" = *\$* ]]; then + opre="${(M)word##*\$[^/]##/}" + else opre="${word%%/*}" + fi + eval 'epre=( ${(e)~opre} )' 2> /dev/null + + if [[ -n "$epre" && $#epre -eq 1 ]]; then pre="${(q)epre[1]}" [[ "$tmp" != changed || $#exp -gt 1 || "${opre}${exp[1]#${pre}}" != "$word" ]] && exp=( ${opre}${^exp#${pre}} ) |