diff options
Diffstat (limited to 'Completion/Core')
-rw-r--r-- | Completion/Core/_expand | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/Completion/Core/_expand b/Completion/Core/_expand index 25145f752..9ba055a6e 100644 --- a/Completion/Core/_expand +++ b/Completion/Core/_expand @@ -18,12 +18,6 @@ local exp word sort expr expl subd suf=" " force opt asp tmp opre pre epre force="$force$opt" done -if [[ "$funcstack[2]" = _prefix ]]; then - word="$IPREFIX$PREFIX$SUFFIX" -else - word="$IPREFIX$PREFIX$SUFFIX$ISUFFIX" -fi - # First, see if we should insert all *completions*. if [[ "$force" = *c* ]] || @@ -34,7 +28,24 @@ if [[ "$force" = *c* ]] || return 1 fi -# In exp we will collect the expansion. +if [[ "$funcstack[2]" = _prefix ]]; then + word="$IPREFIX$PREFIX$SUFFIX" +else + word="$IPREFIX$PREFIX$SUFFIX$ISUFFIX" +fi + +zstyle -t ":completion:${curcontext}:" suffix && + [[ "$word" = (\~*/*|\$[a-zA-Z0-9_]##[^a-zA-Z0-9_]*|\$\{*\}?*) ]] && + return 1 + +zstyle -t ":completion:${curcontext}:" accept-exact || + { [[ "$word" = \~(|[-+]) || + ( "$word" = \~[-+][1-9]## && $word[3,-1] -le $#dirstack ) || + ( "$word" = \~* && ${#userdirs[(I)${word[2,-1]}*]}+${#nameddirs[(I)${word[2,-1]}*]} -ne 1 ) || + ( "$word" = \$[a-zA-Z0-9_]## && + ${#parameters[(I)${word[2,-1]}*]} -ne 1 ) ]] && return 1 } + +# In exp we will collect the expansions. exp=("$word") |