mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-26 18:01:03 +02:00
zsh-workers/9191
This commit is contained in:
parent
3259e583b0
commit
2f76a51352
6 changed files with 41 additions and 13 deletions
|
@ -1,7 +1,5 @@
|
|||
#compdef -default-
|
||||
|
||||
local expl
|
||||
|
||||
# You can first try the `compctl's by uncommenting the `compcall' line
|
||||
# below.
|
||||
# This is without first (-T) and default (-D) completion. If you want
|
||||
|
@ -22,4 +20,4 @@ _files && return 0
|
|||
# file name expansion after the =. In that case, it's natural to
|
||||
# allow completion to handle file names after any equals sign.
|
||||
|
||||
[[ -o magicequalsubst ]] && compset -P 1 '*=' && _files "$expl[@]"
|
||||
[[ -o magicequalsubst ]] && compset -P 1 '*=' && _files
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#autoload
|
||||
|
||||
local name gropt format gname hidden hide
|
||||
local name gropt format gname hidden hide match
|
||||
|
||||
gropt=(-J)
|
||||
hide=()
|
||||
match=()
|
||||
|
||||
if [[ "$1" = -([12]|)[VJ] ]]; then
|
||||
gropt=("$1")
|
||||
|
@ -26,21 +27,23 @@ if [[ "$hidden" = (all|yes|true|1|on) ]]; then
|
|||
fi
|
||||
zstyle -s ":completion${curcontext}:$1" group-name gname &&
|
||||
[[ -z "$gname" ]] && gname="$1"
|
||||
zstyle -s ":completion${curcontext}:$1" matcher match &&
|
||||
match=(-M "${(q)match}")
|
||||
|
||||
shift 2
|
||||
[[ -n "$format" ]] && zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
|
||||
|
||||
if [[ -n "$gname" ]]; then
|
||||
if [[ -n "$format" ]]; then
|
||||
eval "${name}=($hide $gropt ${(q)gname} -X \"${format}\")"
|
||||
eval "${name}=($hide $match $gropt ${(q)gname} -X \"${format}\")"
|
||||
else
|
||||
eval "${name}=($hide $gropt ${(q)gname})"
|
||||
eval "${name}=($hide $match $gropt ${(q)gname})"
|
||||
fi
|
||||
else
|
||||
if [[ -n "$format" ]]; then
|
||||
eval "${name}=($hide $gropt -default- -X \"${format}\")"
|
||||
eval "${name}=($hide $match $gropt -default- -X \"${format}\")"
|
||||
else
|
||||
eval "${name}=($hide $gropt -default-)"
|
||||
eval "${name}=($hide $match $gropt -default-)"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -86,6 +86,15 @@ if (( ! ( $#group + $#expl ) )); then
|
|||
else
|
||||
_description files expl file
|
||||
fi
|
||||
tmp1=$expl[(I)-M]
|
||||
if (( tmp1 )); then
|
||||
match="$match $expl[1+tmp1]"
|
||||
if (( $#matcher )); then
|
||||
matcher[2]="$matcher[2] $expl[1+tmp1]"
|
||||
else
|
||||
matcher=(-M "$expl[1+tmp1]")
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ -n "$tmp1" && $#addsfx -ne 0 ]] && addsfx[1]=-qS
|
||||
|
|
|
@ -939,6 +939,14 @@ hostname, the path to the default web pages for the server and the
|
|||
directory name used by a user placing web pages within their home
|
||||
area.
|
||||
)
|
||||
item(tt(matcher))(
|
||||
This style is tested for tags used when generating matches. Its value
|
||||
is used as an additional match specification to use when adding the
|
||||
matches as described in
|
||||
ifzman(the section `Matching Control' in zmanref(zshcompwid))\
|
||||
ifnzman(noderef(Matching Control))\
|
||||
.
|
||||
)
|
||||
item(tt(max-errors))(
|
||||
This is used by the tt(_approximate) and tt(_correct) completer functions
|
||||
to determine the maximum number of errors to accept. The completer will try
|
||||
|
|
|
@ -562,7 +562,9 @@ into the command line.
|
|||
)
|
||||
item(tt(-M) var(match-spec))(
|
||||
This gives local match specifications as described below in
|
||||
noderef(Matching Control).
|
||||
noderef(Matching Control). This option may be given more than once. In
|
||||
this case all var(match-spec)s given are contaneted with speces
|
||||
between them to form the specification string to use.
|
||||
Note that they will only be used if the tt(-U) option is not given.
|
||||
)
|
||||
item(tt(-n))(
|
||||
|
|
|
@ -435,7 +435,7 @@ static int
|
|||
bin_compadd(char *name, char **argv, char *ops, int func)
|
||||
{
|
||||
struct cadata dat;
|
||||
char *p, **sp, *e, *m = NULL;
|
||||
char *p, **sp, *e, *m = NULL, *mstr = NULL;
|
||||
int dm;
|
||||
Cmatcher match = NULL;
|
||||
|
||||
|
@ -590,13 +590,21 @@ bin_compadd(char *name, char **argv, char *ops, int func)
|
|||
zerrnam(name, e, NULL, *p);
|
||||
return 1;
|
||||
}
|
||||
if (dm && (match = parse_cmatcher(name, m)) == pcm_err) {
|
||||
match = NULL;
|
||||
return 1;
|
||||
if (dm) {
|
||||
if (mstr)
|
||||
mstr = tricat(mstr, " ", m);
|
||||
else
|
||||
mstr = ztrdup(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mstr && (match = parse_cmatcher(name, mstr)) == pcm_err) {
|
||||
zsfree(mstr);
|
||||
return 1;
|
||||
}
|
||||
zsfree(mstr);
|
||||
|
||||
ca_args:
|
||||
|
||||
if (!*argv && !dat.group &&
|
||||
|
|
Loading…
Reference in a new issue