1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 22:11:54 +02:00

enhance ignore-line to ignore all/current/other word(s) (11938)

This commit is contained in:
Sven Wischnowsky 2000-06-16 07:38:59 +00:00
parent 0b892d4492
commit ae2b3953df
3 changed files with 25 additions and 10 deletions

View file

@ -1,5 +1,8 @@
2000-06-16 Sven Wischnowsky <wischnow@zsh.org>
* 11938: Completion/Core/_description, Doc/Zsh/compsys.yo: enhance
ignore-line to ignore all/current/other word(s)
* 11937: Completion/Core/_expand, Completion/Core/_list,
Doc/Zsh/compsys.yo, Doc/Zsh/mod_zutil.yo, Src/Modules/zutil.c:
zstyle -e option; change math-styles to boolean ones; change

View file

@ -30,15 +30,19 @@ zstyle -s ":completion:${curcontext}:$1" matcher match &&
[[ -n "$_matcher" ]] && opts=($opts -M "$_matcher")
if [[ -z "$_comp_no_ignore" ]]; then
if zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore; then
opts=( $opts -F _comp_ignore )
zstyle -t ":completion:${curcontext}:$1" ignore-line &&
_comp_ignore=( "$_comp_ignore[@]" "$words[@]" )
elif zstyle -t ":completion:${curcontext}:$1" ignore-line; then
_comp_ignore=( "$words[@]" )
else
zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore ||
_comp_ignore=()
fi
zstyle -s ":completion:${curcontext}:$1" ignore-line hidden &&
case "$hidden" in
true|yes|on|1) _comp_ignore=( "$_comp_ignore[@]" "$words[@]" );;
current) _comp_ignore=( "$_comp_ignore[@]" "$words[CURRENT]" );;
other) _comp_ignore=( "$_comp_ignore[@]"
"${(@)words[1,CURRENT-1]}"
"${(@)words[CURRENT+1,-1]}" );;
esac
(( $#_comp_ignore )) && opts=( $opts -F _comp_ignore )
else
_comp_ignore=()
fi

View file

@ -1187,9 +1187,17 @@ kindex(ignore-line, completion style)
item(tt(ignore-line))(
This style is tested for the tags used when generating matches. If it
is set to `true', then none of the words that are already on the line
will be considered possible completions.
will be considered possible completions. If it is set to
`tt(current)', the word the cursor is on will not be considered a
possible completion and if it is set to `tt(other)' all words except
the current one will not be considered to be a possible completion.
Note that you almost certainly don't want to set this for a general
The value `tt(current)' is a bit like the opposite of the
tt(accept-exact). It means that only strings with missing characters
will be completed.
Note that you almost certainly don't want to set this to `true' or
`tt(other)' for a general
context such as `tt(:completion:*)'. This is because it would disallow
completion of, for example, options multiple times even if the command
in question accepts the option more than once.