diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-05-08 08:44:52 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-05-08 08:44:52 +0000 |
commit | bedd4cf2c57a89bec8bd98e6ed65082164b69d93 (patch) | |
tree | d7a24e4699e0574717e9f156e63212047cf2ccba | |
parent | 92637abbb870dc35e1af9150741f7b11587a3350 (diff) | |
download | zsh-bedd4cf2c57a89bec8bd98e6ed65082164b69d93.tar.gz zsh-bedd4cf2c57a89bec8bd98e6ed65082164b69d93.tar.xz zsh-bedd4cf2c57a89bec8bd98e6ed65082164b69d93.zip |
make _expand call _complete when called from _expand_word; add ignore-line style to ignore words already on the line (11244)
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Completion/Builtins/_zstyle | 1 | ||||
-rw-r--r-- | Completion/Core/_description | 13 | ||||
-rw-r--r-- | Completion/Core/_expand | 1 | ||||
-rw-r--r-- | Doc/Zsh/compsys.yo | 11 |
5 files changed, 28 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog index 06aef3737..9451c75bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2000-05-08 Sven Wischnowsky <wischnow@informatik.hu-berlin.de> + * 11244: Completion/Builtins/_zstyle, Completion/Core/_description, + Completion/Core/_expand, Doc/Zsh/compsys.yo: make _expand call + _complete when called from _expand_word; add ignore-line style to + ignore words already on the line + * 11242: Completion/Builtins/_pids, Completion/Builtins/_zstyle, Completion/Commands/_complete_help, Completion/Core/_all_labels, Completion/Core/_approximate, Completion/Core/_expand, diff --git a/Completion/Builtins/_zstyle b/Completion/Builtins/_zstyle index 995c8c6f2..9f5bf9352 100644 --- a/Completion/Builtins/_zstyle +++ b/Completion/Builtins/_zstyle @@ -36,6 +36,7 @@ styles=( hosts c:_hosts hosts-ports c:host-port users-hosts-ports c:user-host-port + ignore-line c:bool ignore-parents c:ignorepar ignored-patterns c: insert-ids c:insert-ids diff --git a/Completion/Core/_description b/Completion/Core/_description index 6ee1026bd..9ea478ec5 100644 --- a/Completion/Core/_description +++ b/Completion/Core/_description @@ -29,9 +29,16 @@ zstyle -s ":completion:${curcontext}:$1" matcher match && opts=($opts -M "${(q)match}") [[ -n "$_matcher" ]] && opts=($opts -M "${(q)_matcher}") -if [[ -z "$_comp_no_ignore" ]] && - zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore; then - opts=( $opts -F _comp_ignore ) +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 + _comp_ignore=() + fi else _comp_ignore=() fi diff --git a/Completion/Core/_expand b/Completion/Core/_expand index 985f21899..987a597c7 100644 --- a/Completion/Core/_expand +++ b/Completion/Core/_expand @@ -30,6 +30,7 @@ if [[ "$force" = *c* ]] || { zstyle -s ":completion:${curcontext}:" completions expr && [[ "${(e):-\$[$expr]}" -eq 1 ]] }; then compstate[insert]=all + [[ "$curcontext" = expand-word:* ]] && _complete && return 0 return 1 fi diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index c741959ce..cdfb681bc 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -1175,6 +1175,17 @@ depending on the information already on the line, so that if, for example, the hostname is already typed, only those ports will be completed for which pairs with the hostname from the line exist. ) +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. + +Note that you almost certainly don't want to set this for a general +context such as `tt(:completion:*)'. This because it would disallow +completion of, for example, options multiple times even if the command +in question accepts the option more than once. +) kindex(ignore-parents, completion style) item(tt(ignore-parents))( The style is tested for the tt(files) tag to determine whether to ignore |