mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-29 19:00:57 +02:00
zsh-workers/9731
This commit is contained in:
parent
bf990125d1
commit
e6cc1ece7f
24 changed files with 82 additions and 112 deletions
|
@ -17,9 +17,8 @@ if (( long )); then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
name=${~words[1]}
|
name=${~words[1]}
|
||||||
if [[ "$name" != /* ]]; then
|
[[ "$name" != /* ]] && tmp="$PWD/$name"
|
||||||
tmp="$PWD/$name"
|
|
||||||
fi
|
|
||||||
name="_args_cache_${name}"
|
name="_args_cache_${name}"
|
||||||
name="${name//[^a-zA-Z0-9_]/_}"
|
name="${name//[^a-zA-Z0-9_]/_}"
|
||||||
|
|
||||||
|
@ -255,7 +254,7 @@ if (( $# )) && comparguments -i "$autod" "$@"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$matched" ]] && _requested options &&
|
if [[ -z "$matched" ]] && _requested options &&
|
||||||
{ ! zstyle -t ":completion:${curcontext}:options" prefix-needed ||
|
{ ! zstyle -T ":completion:${curcontext}:options" prefix-needed ||
|
||||||
[[ "$origpre" = [-+]* ||
|
[[ "$origpre" = [-+]* ||
|
||||||
( -z "$aret$mesg" && nm -eq compstate[nmatches] ) ]] } ; then
|
( -z "$aret$mesg" && nm -eq compstate[nmatches] ) ]] } ; then
|
||||||
local prevpre="$PREFIX" previpre="$IPREFIX"
|
local prevpre="$PREFIX" previpre="$IPREFIX"
|
||||||
|
|
|
@ -16,7 +16,7 @@ fi
|
||||||
|
|
||||||
_tags "$_type" || return 1
|
_tags "$_type" || return 1
|
||||||
|
|
||||||
zstyle -t ":completion:${curcontext}:$_type" verbose && _showd=yes
|
zstyle -T ":completion:${curcontext}:$_type" verbose && _showd=yes
|
||||||
|
|
||||||
_description "$_type" _expl "$1"
|
_description "$_type" _expl "$1"
|
||||||
shift
|
shift
|
||||||
|
|
|
@ -5,12 +5,12 @@ local expl disp jobs job jids pfx='%' desc how
|
||||||
_tags jobs || return 1
|
_tags jobs || return 1
|
||||||
|
|
||||||
if [[ "$1" = -t ]]; then
|
if [[ "$1" = -t ]]; then
|
||||||
zstyle -t ":completion:${curcontext}:jobs" prefix-needed &&
|
zstyle -T ":completion:${curcontext}:jobs" prefix-needed &&
|
||||||
[[ "$PREFIX" != %* && compstate[nmatches] -ne 0 ]] && return 1
|
[[ "$PREFIX" != %* && compstate[nmatches] -ne 0 ]] && return 1
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
zstyle -t ":completion:${curcontext}:jobs" prefix-hidden && pfx=''
|
zstyle -t ":completion:${curcontext}:jobs" prefix-hidden && pfx=''
|
||||||
zstyle -t ":completion:${curcontext}:jobs" verbose && desc=yes
|
zstyle -T ":completion:${curcontext}:jobs" verbose && desc=yes
|
||||||
|
|
||||||
if [[ "$1" = -r ]]; then
|
if [[ "$1" = -r ]]; then
|
||||||
jids=( "${(@k)jobstates[(R)running*]}" )
|
jids=( "${(@k)jobstates[(R)running*]}" )
|
||||||
|
|
|
@ -21,7 +21,7 @@ elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then
|
||||||
while _tags; do
|
while _tags; do
|
||||||
if _requested -V indexes expl 'array index'; then
|
if _requested -V indexes expl 'array index'; then
|
||||||
ind=( {1..${#${(P)${compstate[parameter]}}}} )
|
ind=( {1..${#${(P)${compstate[parameter]}}}} )
|
||||||
if zstyle -t ":completion:${curcontext}:indexes" verbose; then
|
if zstyle -T ":completion:${curcontext}:indexes" verbose; then
|
||||||
list=()
|
list=()
|
||||||
for i in "$ind[@]"; do
|
for i in "$ind[@]"; do
|
||||||
[[ "$i" = ${PREFIX}*${SUFFIX} ]] &&
|
[[ "$i" = ${PREFIX}*${SUFFIX} ]] &&
|
||||||
|
|
|
@ -22,9 +22,9 @@ while _tags; do
|
||||||
compadd "$suf[@]" "$expl[@]" "$@" - "${(@k)nameddirs}"
|
compadd "$suf[@]" "$expl[@]" "$@" - "${(@k)nameddirs}"
|
||||||
|
|
||||||
if _requested -V directory-stack expl 'directory stack' &&
|
if _requested -V directory-stack expl 'directory stack' &&
|
||||||
{ ! zstyle -t ":completion:${curcontext}:directory-stack" prefix-needed ||
|
{ ! zstyle -T ":completion:${curcontext}:directory-stack" prefix-needed ||
|
||||||
[[ "$PREFIX" = [-+]* || nm -eq compstate[nmatches] ]] }; then
|
[[ "$PREFIX" = [-+]* || nm -eq compstate[nmatches] ]] }; then
|
||||||
if zstyle -t ":completion:${curcontext}:directory-stack" verbose; then
|
if zstyle -T ":completion:${curcontext}:directory-stack" verbose; then
|
||||||
integer i
|
integer i
|
||||||
|
|
||||||
lines=("${PWD}" "${dirstack[@]}")
|
lines=("${PWD}" "${dirstack[@]}")
|
||||||
|
|
|
@ -16,7 +16,7 @@ zstyle -a ":completion:${curcontext}:ps" arguments args
|
||||||
|
|
||||||
out="$(command ps $args 2>/dev/null)"
|
out="$(command ps $args 2>/dev/null)"
|
||||||
|
|
||||||
if zstyle -t ":completion:${curcontext}:processes" verbose; then
|
if zstyle -T ":completion:${curcontext}:processes" verbose; then
|
||||||
zstyle -a ":completion:${curcontext}:ps" list-arguments listargs
|
zstyle -a ":completion:${curcontext}:ps" list-arguments listargs
|
||||||
(( $#listargs )) || listargs=( "$args[@]" )
|
(( $#listargs )) || listargs=( "$args[@]" )
|
||||||
if [[ "$listargs" = "$args" ]]; then
|
if [[ "$listargs" = "$args" ]]; then
|
||||||
|
|
|
@ -11,10 +11,10 @@ local expl list lines revlines disp
|
||||||
|
|
||||||
_wanted -V directory-stack expl 'directory stack' || return 1
|
_wanted -V directory-stack expl 'directory stack' || return 1
|
||||||
|
|
||||||
! zstyle -t ":completion:${curcontext}:directory-stack" prefix-needed ||
|
! zstyle -T ":completion:${curcontext}:directory-stack" prefix-needed ||
|
||||||
[[ $PREFIX = [-+]* ]] || return 1
|
[[ $PREFIX = [-+]* ]] || return 1
|
||||||
|
|
||||||
if zstyle -t ":completion:${curcontext}:directory-stack" verbose; then
|
if zstyle -T ":completion:${curcontext}:directory-stack" verbose; then
|
||||||
# get the list of directories with their canonical number
|
# get the list of directories with their canonical number
|
||||||
# and turn the lines into an array, removing the current directory
|
# and turn the lines into an array, removing the current directory
|
||||||
lines=("${dirstack[@]}")
|
lines=("${dirstack[@]}")
|
||||||
|
|
|
@ -7,7 +7,7 @@ if [[ CURRENT -eq 2 ]]; then
|
||||||
_wanted -C - jobs expl 'scheduled jobs' || return 1
|
_wanted -C - jobs expl 'scheduled jobs' || return 1
|
||||||
|
|
||||||
lines=(${(f)"$(sched)"})
|
lines=(${(f)"$(sched)"})
|
||||||
if zstyle -t ":completion:${curcontext}:jobs" verbose; then
|
if zstyle -T ":completion:${curcontext}:jobs" verbose; then
|
||||||
disp=( -ld lines )
|
disp=( -ld lines )
|
||||||
else
|
else
|
||||||
disp=()
|
disp=()
|
||||||
|
|
|
@ -22,7 +22,7 @@ done
|
||||||
|
|
||||||
if _wanted signals expl signal &&
|
if _wanted signals expl signal &&
|
||||||
{ [[ -z "$minus" ]] ||
|
{ [[ -z "$minus" ]] ||
|
||||||
! zstyle -t ":completion:${curcontext}:signals" prefix-needed ||
|
! zstyle -T ":completion:${curcontext}:signals" prefix-needed ||
|
||||||
[[ "$PREFIX" = -* ]] } ; then
|
[[ "$PREFIX" = -* ]] } ; then
|
||||||
local disp tmp
|
local disp tmp
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ else
|
||||||
while _tags; do
|
while _tags; do
|
||||||
_requested files && _files && ret=0
|
_requested files && _files && ret=0
|
||||||
_requested options expl 'inode element' &&
|
_requested options expl 'inode element' &&
|
||||||
{ ! zstyle -t ":completion:${curcontext}:options" prefix-needed ||
|
{ ! zstyle -T ":completion:${curcontext}:options" prefix-needed ||
|
||||||
[[ "$PREFIX[1]" = + || ret -eq 1 ]] } &&
|
[[ "$PREFIX[1]" = + || ret -eq 1 ]] } &&
|
||||||
compadd "$expl[@]" - +device +inode +mode +nlink +uid +gid +rdev \
|
compadd "$expl[@]" - +device +inode +mode +nlink +uid +gid +rdev \
|
||||||
+size +atime +mtime +ctime +blksize +block +link
|
+size +atime +mtime +ctime +blksize +block +link
|
||||||
|
|
|
@ -17,7 +17,7 @@ local curcontext="${curcontext}" oldcontext opm="$compstate[pattern_match]"
|
||||||
|
|
||||||
oldcontext="$curcontext"
|
oldcontext="$curcontext"
|
||||||
|
|
||||||
zstyle -s ":completion:${curcontext}:" max-errors cfgacc
|
zstyle -s ":completion:${curcontext}:" max-errors cfgacc || cfgacc='2 numeric'
|
||||||
|
|
||||||
# Get the number of errors to accept.
|
# Get the number of errors to accept.
|
||||||
|
|
||||||
|
|
|
@ -16,17 +16,14 @@ else
|
||||||
fi
|
fi
|
||||||
(( $opts[(I)-F] )) && hasign=yes
|
(( $opts[(I)-F] )) && hasign=yes
|
||||||
|
|
||||||
if [[ "$group[2]" = files ]]; then
|
[[ "$group[2]" = files ]] && opts=("$opts[@]" "$group[@]") group=()
|
||||||
opts=("$opts[@]" "$group[@]")
|
|
||||||
group=()
|
|
||||||
fi
|
|
||||||
|
|
||||||
ign=()
|
ign=()
|
||||||
|
|
||||||
if zstyle -s ":completion:${curcontext}:all-files" file-patterns tmp &&
|
zstyle -s ":completion:${curcontext}:all-files" file-patterns tmp &&
|
||||||
[[ -n "$tmp" ]]; then
|
[[ -n "$tmp" ]] &&
|
||||||
aopts=(-g "$tmp")
|
aopts=(-g "$tmp")
|
||||||
fi
|
|
||||||
if zstyle -s ":completion:${curcontext}:directories" file-patterns tmp &&
|
if zstyle -s ":completion:${curcontext}:directories" file-patterns tmp &&
|
||||||
[[ -n "$tmp" ]]; then
|
[[ -n "$tmp" ]]; then
|
||||||
dopts=(-g "$tmp")
|
dopts=(-g "$tmp")
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
setopt localoptions nullglob rcexpandparam extendedglob
|
setopt localoptions nullglob rcexpandparam extendedglob
|
||||||
unsetopt markdirs globsubst shwordsplit nounset ksharrays
|
unsetopt markdirs globsubst shwordsplit nounset ksharrays
|
||||||
|
|
||||||
local comp post ret=1 _compskip _prio_num=1 format _comp_ignore \
|
local comp post ret=1 _compskip format _comp_ignore \
|
||||||
_completers _completers_left _comp_matcher \
|
_completers _completers_left _comp_matcher \
|
||||||
context state line opt_args val_args curcontext="$curcontext" \
|
context state line opt_args val_args curcontext="$curcontext" \
|
||||||
_last_nmatches=-1 _last_menu_style _def_menu_style _menu_style sel \
|
_last_nmatches=-1 _last_menu_style _def_menu_style _menu_style sel \
|
||||||
|
@ -28,12 +28,6 @@ local comp post ret=1 _compskip _prio_num=1 format _comp_ignore \
|
||||||
_saved_list="${compstate[list]}" \
|
_saved_list="${compstate[list]}" \
|
||||||
_saved_insert="${compstate[insert]}"
|
_saved_insert="${compstate[insert]}"
|
||||||
|
|
||||||
typeset -U _offered_tags _tried_tags _failed_tags _used_tags _unused_tags
|
|
||||||
|
|
||||||
_offered_tags=()
|
|
||||||
_tried_tags=()
|
|
||||||
_failed_tags=()
|
|
||||||
|
|
||||||
typeset -U _lastdescr
|
typeset -U _lastdescr
|
||||||
|
|
||||||
[[ -z "$curcontext" ]] && curcontext=:::
|
[[ -z "$curcontext" ]] && curcontext=:::
|
||||||
|
@ -50,17 +44,13 @@ fi
|
||||||
# Initial setup.
|
# Initial setup.
|
||||||
|
|
||||||
_setup default
|
_setup default
|
||||||
_def_menu_style=( "$_last_menu_style[@]" )
|
_def_menu_style=( "$_last_menu_style[@]"
|
||||||
|
${SELECTMIN+select${SELECTMIN:+\=$SELECTMIN}} )
|
||||||
_last_menu_style=()
|
_last_menu_style=()
|
||||||
|
|
||||||
# Get the names of the completers to use in the positional parameters.
|
# Get the names of the completers to use in the positional parameters.
|
||||||
|
|
||||||
if (( ! $# )); then
|
(( $# )) || zstyle -a ":completion:${curcontext}:" completer argv || set _complete
|
||||||
local tmp
|
|
||||||
|
|
||||||
zstyle -a ":completion:${curcontext}:" completer tmp
|
|
||||||
set -- "$tmp[@]"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# And now just call the completer functions defined.
|
# And now just call the completer functions defined.
|
||||||
|
|
||||||
|
@ -75,7 +65,7 @@ for comp; do
|
||||||
shift 1 _completers_left
|
shift 1 _completers_left
|
||||||
done
|
done
|
||||||
|
|
||||||
if (( $compstate[nmatches] )); then
|
if [[ $compstate[nmatches] -gt 1 ]]; then
|
||||||
[[ _last_nmatches -ge 0 && _last_nmatches -ne compstate[nmatches] ]] &&
|
[[ _last_nmatches -ge 0 && _last_nmatches -ne compstate[nmatches] ]] &&
|
||||||
_menu_style=( "$_last_menu_style[@]" "$_menu_style[@]" )
|
_menu_style=( "$_last_menu_style[@]" "$_menu_style[@]" )
|
||||||
|
|
||||||
|
@ -128,7 +118,7 @@ if (( $compstate[nmatches] )); then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
elif [[ $#_lastdescr -ne 0 ]] &&
|
elif [[ $compstate[nmatches] -eq 0 && $#_lastdescr -ne 0 ]] &&
|
||||||
zstyle -s ":completion:${curcontext}:warnings" format format; then
|
zstyle -s ":completion:${curcontext}:warnings" format format; then
|
||||||
local str
|
local str
|
||||||
|
|
||||||
|
@ -147,11 +137,6 @@ elif [[ $#_lastdescr -ne 0 ]] &&
|
||||||
compadd -UX "$format" -n ''
|
compadd -UX "$format" -n ''
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# See which tags were or were not used.
|
|
||||||
|
|
||||||
_used_tags=( "${(@)_tried_tags:#${(j:|:)~${(@)_failed_tags//\[/\\[}//\]/\\]}}" )
|
|
||||||
_unused_tags=( "${(@)_offered_tags:#${(j:|:)~${(@)_used_tags//\[/\\[}//\]/\\]}}" )
|
|
||||||
|
|
||||||
# Now call the post-functions.
|
# Now call the post-functions.
|
||||||
|
|
||||||
for post in "$comppostfuncs[@]"; do
|
for post in "$comppostfuncs[@]"; do
|
||||||
|
@ -167,10 +152,5 @@ _lastcomp[iprefix]="$IPREFIX"
|
||||||
_lastcomp[isuffix]="$ISUFFIX"
|
_lastcomp[isuffix]="$ISUFFIX"
|
||||||
_lastcomp[qiprefix]="$QIPREFIX"
|
_lastcomp[qiprefix]="$QIPREFIX"
|
||||||
_lastcomp[qisuffix]="$QISUFFIX"
|
_lastcomp[qisuffix]="$QISUFFIX"
|
||||||
_lastcomp[offered_tags]="${(j.:.)_offered_tags}"
|
|
||||||
_lastcomp[tried_tags]="${(j.:.)_tried_tags}"
|
|
||||||
_lastcomp[failed_tags]="${(j.:.)_failed_tags}"
|
|
||||||
_lastcomp[unused_tags]="${(j.:.)_unused_tags}"
|
|
||||||
_lastcomp[used_tags]="${(j.:.)_used_tags}"
|
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
|
@ -66,10 +66,7 @@ fi
|
||||||
name="$cmd1"
|
name="$cmd1"
|
||||||
comp="$_comps[$cmd1]"
|
comp="$_comps[$cmd1]"
|
||||||
|
|
||||||
if [[ -z "$comp" ]]; then
|
[[ -z "$comp" ]] && name="$cmd2" comp="$_comps[$cmd2]"
|
||||||
name="$cmd2"
|
|
||||||
comp="$_comps[$cmd2]"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# And generate the matches, probably using default completion.
|
# And generate the matches, probably using default completion.
|
||||||
|
|
||||||
|
@ -77,12 +74,10 @@ if [[ -n "$comp" ]]; then
|
||||||
_compskip=patterns
|
_compskip=patterns
|
||||||
"$comp" && ret=0
|
"$comp" && ret=0
|
||||||
[[ "$_compskip" = (all|*patterns*) ]] && return ret
|
[[ "$_compskip" = (all|*patterns*) ]] && return ret
|
||||||
else
|
elif [[ "$_compskip" != *default* ]]; then
|
||||||
if [[ "$_compskip" != *default* ]]; then
|
|
||||||
name=-default-
|
name=-default-
|
||||||
comp="$_comps[-default-]"
|
comp="$_comps[-default-]"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$_compskip" != (all|*patterns*) ]]; then
|
if [[ "$_compskip" != (all|*patterns*) ]]; then
|
||||||
for i in "${(@)_postpatcomps[(K)$cmd1]}"; do
|
for i in "${(@)_postpatcomps[(K)$cmd1]}"; do
|
||||||
|
|
|
@ -290,7 +290,7 @@ for prepath in "$prepaths[@]"; do
|
||||||
tmp2=( "$tmp1[@]" )
|
tmp2=( "$tmp1[@]" )
|
||||||
builtin compadd -D tmp1 -F _comp_ignore "$matcher[@]" - "${(@)tmp1:t}"
|
builtin compadd -D tmp1 -F _comp_ignore "$matcher[@]" - "${(@)tmp1:t}"
|
||||||
|
|
||||||
if [[ $#tmp1 -eq 0 && -n "$_comp_correct" ]]; then
|
if [[ $#tmp1 -eq 0 ]]; then
|
||||||
tmp1=( "$tmp2[@]" )
|
tmp1=( "$tmp2[@]" )
|
||||||
compadd -D tmp1 -F _comp_ignore "$matcher[@]" - "${(@)tmp2:t}"
|
compadd -D tmp1 -F _comp_ignore "$matcher[@]" - "${(@)tmp2:t}"
|
||||||
fi
|
fi
|
||||||
|
@ -334,7 +334,7 @@ for prepath in "$prepaths[@]"; do
|
||||||
|
|
||||||
if [[ -z "$tpre$tsuf" && -n "$pre$suf" ]]; then
|
if [[ -z "$tpre$tsuf" && -n "$pre$suf" ]]; then
|
||||||
pfxsfx=(-S '' "$pfxsfx[@]")
|
pfxsfx=(-S '' "$pfxsfx[@]")
|
||||||
break;
|
break
|
||||||
elif [[ "$haspats" = no && -z "$tpre$tsuf" &&
|
elif [[ "$haspats" = no && -z "$tpre$tsuf" &&
|
||||||
"$pre" = */ && -z "$suf" ]]; then
|
"$pre" = */ && -z "$suf" ]]; then
|
||||||
PREFIX="${opre}"
|
PREFIX="${opre}"
|
||||||
|
@ -352,8 +352,8 @@ for prepath in "$prepaths[@]"; do
|
||||||
if [[ "$rem" = *parent* ]]; then
|
if [[ "$rem" = *parent* ]]; then
|
||||||
for i in ${(M)^tmp1:#*/*}(-/); do
|
for i in ${(M)^tmp1:#*/*}(-/); do
|
||||||
remt="${${i#$prepath$realpath$donepath}%/*}"
|
remt="${${i#$prepath$realpath$donepath}%/*}"
|
||||||
while [[ "$remt" = */* ]]; do
|
while [[ "$remt" = */* &&
|
||||||
[[ "$prepath$realpath$donepath$remt" -ef "$i" ]] && break
|
! "$prepath$realpath$donepath$remt" -ef "$i" ]]; do
|
||||||
remt="${remt%/*}"
|
remt="${remt%/*}"
|
||||||
done
|
done
|
||||||
[[ "$remt" = */* || "$remt" -ef "$i" ]] &&
|
[[ "$remt" = */* || "$remt" -ef "$i" ]] &&
|
||||||
|
@ -406,9 +406,7 @@ for prepath in "$prepaths[@]"; do
|
||||||
|
|
||||||
if [[ "$tmp3" = */* ]]; then
|
if [[ "$tmp3" = */* ]]; then
|
||||||
tmp4=( "${(@M)tmp1:#${tmp3%%/*}/*}" )
|
tmp4=( "${(@M)tmp1:#${tmp3%%/*}/*}" )
|
||||||
if (( $#tmp4 )); then
|
(( $#tmp4 )) && tmp1=( "$tmp4[@]" )
|
||||||
tmp1=( "$tmp4[@]" )
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Next we see if this component is ambiguous.
|
# Next we see if this component is ambiguous.
|
||||||
|
|
|
@ -3,12 +3,15 @@
|
||||||
local val nm="$compstate[nmatches]"
|
local val nm="$compstate[nmatches]"
|
||||||
|
|
||||||
if zstyle -a ":completion:${curcontext}:$1" list-colors val; then
|
if zstyle -a ":completion:${curcontext}:$1" list-colors val; then
|
||||||
zmodload -e zsh/complist || zmodload -i zsh/complist
|
zmodload -i zsh/complist
|
||||||
if [[ "$1" = default ]]; then
|
if [[ "$1" = default ]]; then
|
||||||
ZLS_COLORS="${(j.:.)${(@)val:gs/:/\\\:}}"
|
ZLS_COLORS="${(j.:.)${(@)val:gs/:/\\\:}}"
|
||||||
else
|
else
|
||||||
eval "ZLS_COLORS=\"(${1})\${(j.:(${1}).)\${(@)val:gs/:/\\\:}}:\${ZLS_COLORS}\""
|
eval "ZLS_COLORS=\"(${1})\${(j.:(${1}).)\${(@)val:gs/:/\\\:}}:\${ZLS_COLORS}\""
|
||||||
fi
|
fi
|
||||||
|
elif [[ "$1" = default && -n "$ZLS_COLORS$ZLS_COLOURS" ]]; then
|
||||||
|
zmodload -i zsh/complist
|
||||||
|
ZLS_COLORS="$ZLS_COLORS$ZLS_COLOURS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if zstyle -s ":completion:${curcontext}:$1" list-packed val; then
|
if zstyle -s ":completion:${curcontext}:$1" list-packed val; then
|
||||||
|
|
|
@ -35,9 +35,6 @@ if (( $# )); then
|
||||||
|
|
||||||
comptags -i "$curcontext" "$@"
|
comptags -i "$curcontext" "$@"
|
||||||
|
|
||||||
_offered_tags=( "$_offered_tags[@]" "$@" )
|
|
||||||
_last_tags=()
|
|
||||||
|
|
||||||
# Sort the tags.
|
# Sort the tags.
|
||||||
|
|
||||||
if [[ -n "$_sort_tags" ]]; then
|
if [[ -n "$_sort_tags" ]]; then
|
||||||
|
@ -55,6 +52,15 @@ if (( $# )); then
|
||||||
|
|
||||||
[[ -z "$nodef" ]] && comptry "$@"
|
[[ -z "$nodef" ]] && comptry "$@"
|
||||||
else
|
else
|
||||||
|
|
||||||
|
# The first ones give the default behaviour.
|
||||||
|
|
||||||
|
comptry arguments values
|
||||||
|
comptry options
|
||||||
|
comptry globbed-files
|
||||||
|
comptry directories
|
||||||
|
comptry all-files
|
||||||
|
|
||||||
comptry "$@"
|
comptry "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -67,20 +73,4 @@ fi
|
||||||
|
|
||||||
# The other mode: switch to the next set of tags.
|
# The other mode: switch to the next set of tags.
|
||||||
|
|
||||||
local tags
|
comptags -N
|
||||||
|
|
||||||
_failed_tags=( "$_failed_tags[@]" "$_last_tags[@]" )
|
|
||||||
|
|
||||||
# Return failure if no sets remaining.
|
|
||||||
|
|
||||||
comptags -N || return 1
|
|
||||||
|
|
||||||
# Otherwise get the next tags.
|
|
||||||
|
|
||||||
comptags -S _last_tags
|
|
||||||
|
|
||||||
_tried_tags=( "$_tried_tags[@]" "$_last_tags[@]" )
|
|
||||||
|
|
||||||
shift 1 "$prios"
|
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
|
@ -470,19 +470,6 @@ compstyle() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Default styles. This should be executed conditionally somehow.
|
|
||||||
|
|
||||||
zstyle ':completion:*' verbose 'yes'
|
|
||||||
zstyle ':completion:*' prefix-needed 'yes'
|
|
||||||
zstyle ':completion:*' prefix-hidden 'no'
|
|
||||||
zstyle ':completion:*:(correct|approximate):*' max-errors '2' numeric
|
|
||||||
zstyle ':completion:*:correct:*' prompt 'correct to:'
|
|
||||||
zstyle ':completion:*::::' completer '_complete'
|
|
||||||
zstyle ':completion:*::::default' list-colors "${(s.:.)ZLS_COLORS:-${ZLS_COLOURS:-no=0:fi=0:di=0:ln=0:pi=0:so=0:bd=0:cd=0:ex=0}}"
|
|
||||||
(( $+SELECTMIN )) && zstyle ':completion:*::::default' menu "select=$SELECTMIN"
|
|
||||||
zstyle ':completion:*' tag-order 'arguments values' options \
|
|
||||||
globbed-files directories all-files
|
|
||||||
|
|
||||||
# Now we automatically make the definition files autoloaded.
|
# Now we automatically make the definition files autoloaded.
|
||||||
|
|
||||||
typeset -U _i_files
|
typeset -U _i_files
|
||||||
|
|
|
@ -106,7 +106,7 @@ tmp2=("$tmp2[@]" $_ra_left${(M)^short_bool:#$~tmp1} $_ra_left${(M)^short_intleve
|
||||||
tmp3=("$tmp3[@]" $_ra_left${(M)^short_hasarg:#$~tmp1} $_ra_left${(M)^short_configfile:#$~tmp1} $_ra_left${(M)^short_arbitem:#$~tmp1})
|
tmp3=("$tmp3[@]" $_ra_left${(M)^short_hasarg:#$~tmp1} $_ra_left${(M)^short_configfile:#$~tmp1} $_ra_left${(M)^short_arbitem:#$~tmp1})
|
||||||
_describe -o option tmp2 -- tmp3 -S='
|
_describe -o option tmp2 -- tmp3 -S='
|
||||||
|
|
||||||
comp_opt='{ ! zstyle -t ":completion:${curcontext}:options" prefix-needed || [[ "$PREFIX" = -* ]] }'" && { $comp_short; $comp_long }"
|
comp_opt='{ ! zstyle -T ":completion:${curcontext}:options" prefix-needed || [[ "$PREFIX" = -* ]] }'" && { $comp_short; $comp_long }"
|
||||||
|
|
||||||
regex_short=()
|
regex_short=()
|
||||||
regex_long=()
|
regex_long=()
|
||||||
|
|
|
@ -37,7 +37,7 @@ fi
|
||||||
|
|
||||||
if compset -P -P || [[ "$words[CURRENT-1]" = -P ]]; then
|
if compset -P -P || [[ "$words[CURRENT-1]" = -P ]]; then
|
||||||
if _wanted printers expl printer; then
|
if _wanted printers expl printer; then
|
||||||
if zstyle -t ":completion:${curcontext}:printers" verbose; then
|
if zstyle -T ":completion:${curcontext}:printers" verbose; then
|
||||||
zformat -a list ' -- ' "$_lp_cache[@]"
|
zformat -a list ' -- ' "$_lp_cache[@]"
|
||||||
disp=(-ld list)
|
disp=(-ld list)
|
||||||
else
|
else
|
||||||
|
@ -47,7 +47,7 @@ if compset -P -P || [[ "$words[CURRENT-1]" = -P ]]; then
|
||||||
|
|
||||||
(( $+_lp_alias_cache )) || return 1
|
(( $+_lp_alias_cache )) || return 1
|
||||||
|
|
||||||
if zstyle -t ":completion:${curcontext}:printers" verbose; then
|
if zstyle -T ":completion:${curcontext}:printers" verbose; then
|
||||||
zformat -a list ' -- ' "$_lp_alias_cache[@]"
|
zformat -a list ' -- ' "$_lp_alias_cache[@]"
|
||||||
disp=(-ld list)
|
disp=(-ld list)
|
||||||
else
|
else
|
||||||
|
@ -73,7 +73,7 @@ else
|
||||||
if _requested users expl user; then
|
if _requested users expl user; then
|
||||||
strs=( "${(@)${(@)list##[^ ]##[ ]##[^ ]##[ ]##}%%[ ]*}" )
|
strs=( "${(@)${(@)list##[^ ]##[ ]##[^ ]##[ ]##}%%[ ]*}" )
|
||||||
if [[ -z "$shown" ]] &&
|
if [[ -z "$shown" ]] &&
|
||||||
zstyle -t ":completion:${curcontext}:users" verbose; then
|
zstyle -T ":completion:${curcontext}:users" verbose; then
|
||||||
disp=(-ld list)
|
disp=(-ld list)
|
||||||
shown=yes
|
shown=yes
|
||||||
else
|
else
|
||||||
|
@ -84,7 +84,7 @@ else
|
||||||
if _requested jobs expl job; then
|
if _requested jobs expl job; then
|
||||||
strs=( "${(@)${(@)list##[^ ]##[ ]##[^ ]##[ ]##[^ ]##[ ]##}%%[ ]*}" )
|
strs=( "${(@)${(@)list##[^ ]##[ ]##[^ ]##[ ]##[^ ]##[ ]##}%%[ ]*}" )
|
||||||
if [[ -z "$shown" ]] &&
|
if [[ -z "$shown" ]] &&
|
||||||
zstyle -t ":completion:${curcontext}:jobs" verbose; then
|
zstyle -T ":completion:${curcontext}:jobs" verbose; then
|
||||||
disp=(-ld list)
|
disp=(-ld list)
|
||||||
shown=yes
|
shown=yes
|
||||||
else
|
else
|
||||||
|
|
|
@ -9,7 +9,7 @@ local curcontext="$curcontext" state line expl
|
||||||
typeset -A opt_args
|
typeset -A opt_args
|
||||||
|
|
||||||
[[ $CURRENT -eq 2 ]] && _wanted options expl option &&
|
[[ $CURRENT -eq 2 ]] && _wanted options expl option &&
|
||||||
{ ! zstyle -t ":completion:${curcontext}:options" prefix-needed ||
|
{ ! zstyle -T ":completion:${curcontext}:options" prefix-needed ||
|
||||||
[[ "$PREFIX" = -* ]] } &&
|
[[ "$PREFIX" = -* ]] } &&
|
||||||
compadd -M 'r:|[_-]=* r:|=*' "$expl[@]" - -version
|
compadd -M 'r:|[_-]=* r:|=*' "$expl[@]" - -version
|
||||||
|
|
||||||
|
|
|
@ -713,6 +713,9 @@ only completion for prediction one could use:
|
||||||
example(zstyle ':completion:::::' completer _complete _correct _approximate
|
example(zstyle ':completion:::::' completer _complete _correct _approximate
|
||||||
zstyle ':completion:incremental::::' completer _complete _correct
|
zstyle ':completion:incremental::::' completer _complete _correct
|
||||||
zstyle ':completion:predict::::' completer _complete)
|
zstyle ':completion:predict::::' completer _complete)
|
||||||
|
|
||||||
|
The default value for this style is tt(_complete), i.e. normally only
|
||||||
|
completion will be done.
|
||||||
)
|
)
|
||||||
item(tt(completions))(
|
item(tt(completions))(
|
||||||
This style is used by the tt(_expand) completer function.
|
This style is used by the tt(_expand) completer function.
|
||||||
|
@ -1115,7 +1118,10 @@ will em(not) try to generate corrected
|
||||||
completions when given a numeric argument, so in this case the number given
|
completions when given a numeric argument, so in this case the number given
|
||||||
should be greater than zero. For example, `tt(2 not-numeric)' specifies that
|
should be greater than zero. For example, `tt(2 not-numeric)' specifies that
|
||||||
correcting completion with two errors will usually be performed, but if a
|
correcting completion with two errors will usually be performed, but if a
|
||||||
numeric argument is given, correcting completion will not be performed.
|
numeric argument is given, correcting completion will not be
|
||||||
|
performed.
|
||||||
|
|
||||||
|
The default value for this style contains tt(2) and tt(numeric).
|
||||||
)
|
)
|
||||||
item(tt(menu))(
|
item(tt(menu))(
|
||||||
This style is tested for the tt(default) tag and the tags used when
|
This style is tested for the tt(default) tag and the tags used when
|
||||||
|
@ -1219,6 +1225,8 @@ item(tt(prefix-hidden))(
|
||||||
This is used when matches with a common prefix are added (e.g. option
|
This is used when matches with a common prefix are added (e.g. option
|
||||||
names). If it is `true', this prefix will not be shown in the list of
|
names). If it is `true', this prefix will not be shown in the list of
|
||||||
matches.
|
matches.
|
||||||
|
|
||||||
|
The default value for this style is `false'.
|
||||||
)
|
)
|
||||||
item(tt(prefix-needed))(
|
item(tt(prefix-needed))(
|
||||||
This, too, is used for matches with a common prefix. If it is set to
|
This, too, is used for matches with a common prefix. If it is set to
|
||||||
|
@ -1226,6 +1234,8 @@ This, too, is used for matches with a common prefix. If it is set to
|
||||||
matches. E.g. for options this means that the `tt(-)', `tt(+)', or
|
matches. E.g. for options this means that the `tt(-)', `tt(+)', or
|
||||||
`tt(-)tt(-)' has to be on the line to make option names be completed at
|
`tt(-)tt(-)' has to be on the line to make option names be completed at
|
||||||
all.
|
all.
|
||||||
|
|
||||||
|
The default style for this style is `true'.
|
||||||
)
|
)
|
||||||
item(tt(prompt))(
|
item(tt(prompt))(
|
||||||
The tt(incremental-complete-word) widget shows the value of this
|
The tt(incremental-complete-word) widget shows the value of this
|
||||||
|
@ -1344,7 +1354,10 @@ in which order tags are to be used based on additional context
|
||||||
information. See the tt(_sort_tags) function below for a description
|
information. See the tt(_sort_tags) function below for a description
|
||||||
of how such functions can be implemented.
|
of how such functions can be implemented.
|
||||||
|
|
||||||
If no style has been defined for a context, all tags will be used.
|
If no style has been defined for a context, the strings tt(arguments
|
||||||
|
values), tt(options), tt(globbed-files), tt(directories) and
|
||||||
|
tt(all-files) plus all tags offered by the completion function will be
|
||||||
|
used.
|
||||||
)
|
)
|
||||||
item(tt(users))(
|
item(tt(users))(
|
||||||
This may be set to a list of names that should be completed whenever
|
This may be set to a list of names that should be completed whenever
|
||||||
|
@ -1369,7 +1382,9 @@ the tt(accounts) tag.
|
||||||
item(tt(verbose))(
|
item(tt(verbose))(
|
||||||
This is used in several contexts to decide if only a simple or a
|
This is used in several contexts to decide if only a simple or a
|
||||||
verbose list of matches should be generated. For example some commands
|
verbose list of matches should be generated. For example some commands
|
||||||
show descriptions for option names if this style is true.
|
show descriptions for option names if this style is `true'.
|
||||||
|
|
||||||
|
The default value for this style is `true'.
|
||||||
)
|
)
|
||||||
item(tt(word))(
|
item(tt(word))(
|
||||||
To find out if listing should be performed on its own, the tt(_list)
|
To find out if listing should be performed on its own, the tt(_list)
|
||||||
|
|
|
@ -15,6 +15,7 @@ xitem(tt(zstyle -b) var(context) var(style) var(name))
|
||||||
xitem(tt(zstyle -a) var(context) var(style) var(name))
|
xitem(tt(zstyle -a) var(context) var(style) var(name))
|
||||||
xitem(tt(zstyle -h) var(context) var(style) var(name))
|
xitem(tt(zstyle -h) var(context) var(style) var(name))
|
||||||
xitem(tt(zstyle -t) var(context) var(style) [ var(strings) ...])
|
xitem(tt(zstyle -t) var(context) var(style) [ var(strings) ...])
|
||||||
|
xitem(tt(zstyle -T) var(context) var(style) [ var(strings) ...])
|
||||||
item(tt(zstyle -m) var(context) var(style) var(pattern))(
|
item(tt(zstyle -m) var(context) var(style) var(pattern))(
|
||||||
This builtin command is used to define and lookup styles. Styles are
|
This builtin command is used to define and lookup styles. Styles are
|
||||||
pairs of names and values, where the values consist of any number of
|
pairs of names and values, where the values consist of any number of
|
||||||
|
@ -63,7 +64,7 @@ makes it be returned as an associative array (with the first, third,
|
||||||
etc. string being used as the keys and the other strings being used as
|
etc. string being used as the keys and the other strings being used as
|
||||||
the values).
|
the values).
|
||||||
|
|
||||||
The tt(-t) option can be used to test the value of a style, i.e. it
|
The tt(-t) options can be used to test the value of a style, i.e. it
|
||||||
only sets the return value. Without any var(strings) arguments it is
|
only sets the return value. Without any var(strings) arguments it is
|
||||||
zero if the style is defined for at least one matching pattern, has
|
zero if the style is defined for at least one matching pattern, has
|
||||||
only one string in its value and that is equal to one of tt(true),
|
only one string in its value and that is equal to one of tt(true),
|
||||||
|
@ -71,6 +72,9 @@ tt(yes), tt(on) or tt(1). If any var(strings) are given the return
|
||||||
zero if and only if at least one of the var(strings) is equal to at
|
zero if and only if at least one of the var(strings) is equal to at
|
||||||
least one of the strings in the value.
|
least one of the strings in the value.
|
||||||
|
|
||||||
|
The tt(-T) option is like tt(-t) but returns zero if the style is not
|
||||||
|
set for any matching pattern.
|
||||||
|
|
||||||
The tt(-m) option can be used to match a value. It returns zero if the
|
The tt(-m) option can be used to match a value. It returns zero if the
|
||||||
var(pattern) matches at least one of the strings in the value.
|
var(pattern) matches at least one of the strings in the value.
|
||||||
)
|
)
|
||||||
|
|
|
@ -285,6 +285,7 @@ bin_zstyle(char *nam, char **args, char *ops, int func)
|
||||||
case 'a': min = 3; max = 3; break;
|
case 'a': min = 3; max = 3; break;
|
||||||
case 'h': min = 3; max = 3; break;
|
case 'h': min = 3; max = 3; break;
|
||||||
case 't': min = 2; max = -1; break;
|
case 't': min = 2; max = -1; break;
|
||||||
|
case 'T': min = 2; max = -1; break;
|
||||||
case 'm': min = 3; max = 3; break;
|
case 'm': min = 3; max = 3; break;
|
||||||
case 'g': min = 1; max = 3; break;
|
case 'g': min = 1; max = 3; break;
|
||||||
default:
|
default:
|
||||||
|
@ -417,6 +418,7 @@ bin_zstyle(char *nam, char **args, char *ops, int func)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
|
case 'T':
|
||||||
{
|
{
|
||||||
Stypat s;
|
Stypat s;
|
||||||
|
|
||||||
|
@ -438,7 +440,7 @@ bin_zstyle(char *nam, char **args, char *ops, int func)
|
||||||
!strcmp(s->vals[0], "on") ||
|
!strcmp(s->vals[0], "on") ||
|
||||||
!strcmp(s->vals[0], "1"));
|
!strcmp(s->vals[0], "1"));
|
||||||
}
|
}
|
||||||
return 1;
|
return (args[0][1] == 't');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
|
|
Loading…
Reference in a new issue