Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: zstyle problems
- X-seq: zsh-users 5409
- From: Borzenkov Andrey <Andrej.Borsenkow@xxxxxxxxxxxxxx>
- To: "'Jonas Juselius'" <jonas@xxxxxx>, zsh-users@xxxxxxxxxx
- Subject: RE: zstyle problems
- Date: Wed, 2 Oct 2002 12:16:08 +0400
- Importance: Normal
- In-reply-to: <20021002075023.GA802@xxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
> but I still think this is a bit confusing. Typing 'cd' and then
> pressing ^Xh says 'tags in context :completion::complete:cd::', which
> made me think that this was the actual context...
That is correct for the time when actual completion for cd is done.
But completion is a hierarchical process, and it looks up styles at
different steps, so in early stage some information is not yet
available.
When completion starts, it knows only
- it is completion :-)
- actual command line contents
- whether it has been called as default, context sensitive, completion
or explicitly as special completion widget.
So at this stage it can just fill in the first two fields, notably
:completion: :
^ ^
| + default completion (for a widget here is a widget name)
+ completion (as opposed to e.g. styles for zftp function
sybsystem)
The first step it does at this point (after some initialization) is to
decide what completer to use. It is completer that actually generates
matches. Because the above is the only available information, completion
looks up completer(s) using the context :completion:::::, for a
complete-history widget this would be (probably)
:completion:history-complete::::.
Then completer fills in next part of context, then it decides if we are
completing command, parameter etc and fills in next part of context etc.
I too wish it is better described in manuals. At least, those cases when
styles are looked up using non-standard context definitely must be made
clear. Unfortunately, most examples overuse wildcards thus hiding this.
> What would be the
> correct way of defining different (individual) completions for 'cd'
and
> other
> commands?
>
Mostly it is what you have done. For cd context is
:completion::complete:cd:: with optional specific tag names appended.
For completion based on _arguments you may add argument-N or option-N as
last part to modify completion for specific options/arguments. You may
also use :completion:*:... for both default context sensitive completion
and completion widgets.
-andrey
Messages sorted by:
Reverse Date,
Date,
Thread,
Author