Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Re[2]: how to customize _all_matches use?
- X-seq: zsh-users 11579
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Re[2]: how to customize _all_matches use?
- Date: Sun, 17 Jun 2007 00:17:53 +0100
- In-reply-to: Message from Vadim Zeitlin <vz-zsh@xxxxxxxxxxxx> of "Sat, 16 Jun 2007 21:05:42 +0200." <20070616190558.ZFD20407.aamtain07-winn.ispmail.ntl.com@xxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
Vadim Zeitlin wrote:
> It does work if I do
>
> zstyle ':completion:all-matches:*' tag-order ...
>
> but I still don't know how to limit this for cvs completion only as using
> the context of ':completion:all-matches:cvs-commit:*' doesn't work. I
> wonder if _complete_help can somehow be used to show the context for
> another completer?
The patch to _complete_help below allows you to tweak the completions as
follows:
zle -C all-matches complete-word _complete_help
zstyle ':completion:*' help-function _generic
Then ^xa calls _complete_help which calls _generic with the context
including all-matches. As _generic hasn't been called at that point,
unfortunately we need a very general context for help-function, so you
need to alter the style to get this to work and then change it back or
delete it, and you need to change the definition of all-matches, too. I
won't commit this because I've a feeling there ought to be a better way
of doing it, in particular a simple way of making it work for generic
widgets with a single keystroke.
Anyway, it gives you the following (I've wrapped some long lines):
tags in context :completion:all-matches:complete:cvs::
argument-rest (_arguments _cvs)
tags in context :completion:all-matches:complete:cvs-commit::
argument-rest options (_arguments _cvs_commit _call_function
_cvs_command _arguments _cvs)
tags in context :completion:all-matches:complete:cvs-commit:argument-rest:
directories existing-files removed-files (_alternative
_cvs_files_modified _arguments _cvs_commit _call_function
_cvs_command _arguments _cvs)
directories (_cvs_existing_directories
_alternative _cvs_files_modified _arguments _cvs_commit
_call_function _cvs_command _arguments _cvs)
files (_cvs_existing_entries
_cvs_modified_entries _alternative _cvs_files_modified _arguments
_cvs_commit _call_function _cvs_command _arguments _cvs)
files (_cvs_nonexistent_entries
_alternative _cvs_files_modified _arguments _cvs_commit
_call_function _cvs_command _arguments _cvs)
This suggests the context is being processed OK and hence tag-order
ought to pick it up. Did you remember the ":complete:" chunk of the
context?
Index: Completion/Base/Widget/_complete_help
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Widget/_complete_help,v
retrieving revision 1.5
diff -u -r1.5 _complete_help
--- Completion/Base/Widget/_complete_help 8 Jul 2002 08:59:40 -0000 1.5
+++ Completion/Base/Widget/_complete_help 16 Jun 2007 23:08:42 -0000
@@ -37,7 +37,9 @@
}
trap 'unfunction compadd zstyle' EXIT INT
- _main_complete
+ zstyle -s ":completion:${curcontext}:" help-function tmp ||
+ tmp=_main_complete
+ $tmp
unfunction compadd zstyle
trap - EXIT INT
I must not reply to zsh queries at all hours of the day and night
I must not reply to zsh queries at all hours of the day and night
I must not reply to zsh queries at all hours of the day and night
I must not reply to zsh queries at all hours of the day and night
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author