summaryrefslogtreecommitdiff
path: root/Completion/Base/Core
diff options
context:
space:
mode:
authorOliver Kiddle <okiddle@yahoo.co.uk>2019-05-07 23:24:49 +0200
committerOliver Kiddle <okiddle@yahoo.co.uk>2019-05-07 23:24:49 +0200
commitcd6fd2b0a3641774e7854ff8298d1d82643c4b4a (patch)
tree1b09fbc0dfed078e48c945352c6635a4a6bcbb04 /Completion/Base/Core
parent5200637bda09e34da934e18f3c30f4b124d8d597 (diff)
downloadzsh-cd6fd2b0a3641774e7854ff8298d1d82643c4b4a.tar.gz
zsh-cd6fd2b0a3641774e7854ff8298d1d82643c4b4a.zip
44274: allow finer control of completion match soring with compadd's -o option
Diffstat (limited to 'Completion/Base/Core')
-rw-r--r--Completion/Base/Core/_description32
1 files changed, 18 insertions, 14 deletions
diff --git a/Completion/Base/Core/_description b/Completion/Base/Core/_description
index 304c747a6..c2a0e080b 100644
--- a/Completion/Base/Core/_description
+++ b/Completion/Base/Core/_description
@@ -1,13 +1,13 @@
#autoload
-local name gropt nopt xopt format gname hidden hide match opts tag sort
+local name nopt xopt format gname hidden hide match opts tag
+local -a gropt sort
opts=()
-gropt=(-J)
xopt=(-X)
nopt=()
-zparseopts -K -D -a nopt 1 2 V=gropt J=gropt x=xopt
+zparseopts -K -D -a nopt 1 2 V=gropt J x=xopt
3="${${3##[[:blank:]]#}%%[[:blank:]]#}"
[[ -n "$3" ]] && _lastdescr=( "$_lastdescr[@]" "$3" )
@@ -33,14 +33,18 @@ zstyle -s ":completion:${curcontext}:$1" matcher match &&
# Use sort style, but ignore `menu' value to help _expand.
# Also don't override explicit use of -V.
-if { zstyle -s ":completion:${curcontext}:$1" sort sort ||
- zstyle -s ":completion:${curcontext}:" sort sort; } &&
- [[ "$gropt" = -J && $sort != menu ]]; then
- if [[ "$sort" = (yes|true|1|on) ]]; then
- gropt=(-J)
- else
- gropt=(-V)
+if [[ -z "$gropt" ]]; then
+ if zstyle -a ":completion:${curcontext}:$1" sort sort ||
+ zstyle -a ":completion:${curcontext}:" sort sort
+ then
+ if [[ -z "${(@)sort:#(match|numeric|reverse)}" ]]; then
+ gropt=( -o ${(j.,.)sort} )
+ elif [[ "$sort" != (yes|true|1|on|menu) ]]; then
+ gropt=( -o nosort )
fi
+ fi
+else
+ gropt=( -o nosort )
fi
if [[ -z "$_comp_no_ignore" ]]; then
@@ -79,15 +83,15 @@ fi
if [[ -n "$gname" ]]; then
if [[ -n "$format" ]]; then
- set -A "$name" "$opts[@]" "$nopt[@]" "$gropt" "$gname" "$xopt" "$format"
+ set -A "$name" "$opts[@]" "$nopt[@]" "$gropt[@]" -J "$gname" "$xopt" "$format"
else
- set -A "$name" "$opts[@]" "$nopt[@]" "$gropt" "$gname"
+ set -A "$name" "$opts[@]" "$nopt[@]" "$gropt[@]" -J "$gname"
fi
else
if [[ -n "$format" ]]; then
- set -A "$name" "$opts[@]" "$nopt[@]" "$gropt" -default- "$xopt" "$format"
+ set -A "$name" "$opts[@]" "$nopt[@]" "$gropt[@]" -J -default- "$xopt" "$format"
else
- set -A "$name" "$opts[@]" "$nopt[@]" "$gropt" -default-
+ set -A "$name" "$opts[@]" "$nopt[@]" "$gropt[@]" -J -default-
fi
fi