diff options
Diffstat (limited to 'Completion/Base')
-rw-r--r-- | Completion/Base/.distfiles | 2 | ||||
-rw-r--r-- | Completion/Base/_brace_parameter | 10 | ||||
-rw-r--r-- | Completion/Base/_condition | 2 | ||||
-rw-r--r-- | Completion/Base/_long_options | 1 | ||||
-rw-r--r-- | Completion/Base/_math | 18 | ||||
-rw-r--r-- | Completion/Base/_tilde | 8 |
6 files changed, 35 insertions, 6 deletions
diff --git a/Completion/Base/.distfiles b/Completion/Base/.distfiles index 7e7635fa6..6f634c0b8 100644 --- a/Completion/Base/.distfiles +++ b/Completion/Base/.distfiles @@ -1,6 +1,6 @@ DISTFILES_SRC=' .distfiles _brace_parameter _command_names _condition _default _equal - _long_options _match_pattern _match_pattern.orig _match_test _parameter + _long_options _match_pattern _match_test _math _parameter _precommand _redirect _subscript _tilde _vars ' diff --git a/Completion/Base/_brace_parameter b/Completion/Base/_brace_parameter index 3fab8510a..3d663a777 100644 --- a/Completion/Base/_brace_parameter +++ b/Completion/Base/_brace_parameter @@ -1,5 +1,9 @@ #defcomp -brace-parameter- -# Simple but without spiffy suffix handling: compgen -v -S '} ' - -compadd -S '} ' -r '-:?#%+=[/' - "${(@)${(@)${(@f)$(set)}%%\=*}:gs/'//}" +if [[ "$SUFFIX" = *\}* ]]; then + ISUFFIX="${SUFFIX#*\}}$ISUFFIX" + SUFFIX="${SUFFIX%%\}*}" + _parameters -S '} ' -r '-:?#%+=[/' +else + _parameters -S '} ' -r '-:?#%+=[/' +fi diff --git a/Completion/Base/_condition b/Completion/Base/_condition index db1adfd9a..df1bf913e 100644 --- a/Completion/Base/_condition +++ b/Completion/Base/_condition @@ -3,7 +3,7 @@ local prev="$words[CURRENT-1]" if [[ "$prev" = -o ]]; then - compgen -o -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' + _options elif [[ "$prev" = -([no]t|ef) ]]; then _files else diff --git a/Completion/Base/_long_options b/Completion/Base/_long_options index cc3175592..97b11f2dc 100644 --- a/Completion/Base/_long_options +++ b/Completion/Base/_long_options @@ -212,6 +212,7 @@ if [[ "$str" = *\=* ]]; then pat="${pre}*" patflags='' _match_pattern _long_options pat patflags + [[ -n "$_comp_correct" ]] && patflags="$patflags(#a$_comp_correct)" # Then we walk through the array names. For each array we test if it diff --git a/Completion/Base/_math b/Completion/Base/_math new file mode 100644 index 000000000..f7f4c360f --- /dev/null +++ b/Completion/Base/_math @@ -0,0 +1,18 @@ +#defcomp -math- + +if [[ "$PREFIX" = *[^a-zA-Z0-9_]* ]]; then + IPREFIX="$IPREFIX${PREFIX%%[a-zA-Z0-9_]#}" + PREFIX="${PREFIX##*[^a-zA-Z0-9_]}" +fi +if [[ "$SUFFIX" = *[^a-zA-Z0-9_]* ]]; then + ISUFFIX="${SUFFIX##[a-zA-Z0-9_]#}$ISUFFIX" + SUFFIX="${SUFFIX%%[^a-zA-Z0-9_]*}" +fi + +compgen -v +#defcomp -math- + +IPREFIX="$IPREFIX${PREFIX%[a-zA-Z0-9_]*}" +PREFIX="${PREFIX##*[^a-zA-Z0-9_]}" + +compgen -v diff --git a/Completion/Base/_tilde b/Completion/Base/_tilde index aef575e19..c5ebb66d5 100644 --- a/Completion/Base/_tilde +++ b/Completion/Base/_tilde @@ -7,4 +7,10 @@ # `(( compstate[nmatches] )) || compgen -nu -qS/' # below that. -compgen -nu -qS/ +if [[ "$SUFFIX" = */* ]]; then + ISUFFIX="/${SUFFIX#*/}$ISUFFIX" + SUFFIX="${SUFFIX%%/*}" + compgen -nu -S '' +else + compgen -nu -qS/ +fi |