Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: problem with context specification



thanks all for the clarifications. I will try to use the method described
in the tag-order style documentation

to answer Daniel:

> I take it the documentation of zstyle didn't make this clear, so could you
> suggest how to improve it?

It's not clear to me what is the meaning of the various "sections"of the
pattern (the segments delimited by the colons)
what should I put in the first section? is there a list of possible values
and relative meaning?
and so on for each section
why the number of sections is not the same for every pattern? How can I
know how many pattern I should put in?
I assume the stars are for matching every possible value for that segment,
are there other globbing operators available? can I use them for
prefix/suffix matching? (eg someth* for something etc)
Not that I think it would be particularly useful, but the question came to
mind
I assume also that the stars don't match multiple segments, but this
doesn't seem to be stated in the docs.

regards

Pier Paolo Grassi
linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217
founder: https://www.meetup.com/it-IT/Machine-Learning-TO


Il giorno lun 13 gen 2020 alle ore 18:06 Daniel Shahaf <
d.s@xxxxxxxxxxxxxxxxxx> ha scritto:

> Pier Paolo Grassi wrote on Mon, Jan 13, 2020 at 17:46:09 +0100:
> > if I substitute this as the general case, eg:
> >
> >   zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z} l:|=* r:|=*'
> >
> > then everything get this style, so the syntax is correct. it seem that
> what
> > is wrong is the pattern.
> > I tried some variations of it, with no success:
> >
> >   zstyle ':completion:*:*:episodes:*' ...
> >   zstyle ':completion:*:episodes:*' ...
> >
> > my main problem is that I don't really understand the pattern syntax, and
> > haven't been able to find a man page detailing it (the documentation on
> the
> > zstyle builtin doesn't explain it), so I basically try random variations.
>
> The documentation does explain it; quote:
>
>               For ordering of comparisons, patterns are searched from most
>               specific to least specific, and patterns that are equally
>               specific keep the order in which they were defined.  A
> pattern
>               is considered to be more specific than another if it contains
>               more components (substrings separated by colons) or if the
>               patterns for the components are more specific, where simple
>               strings are considered to be more specific than patterns and
>               complex patterns are considered to be more specific than the
>               pattern `*'.
>
> The upshot of this is that each of the patterns
> ':completion:*:*:episodes:*'
> and ':completion:*:episodes:*' is considered to be more specific than
> ':completion:*'.  A style set under either of the former would have
> precedence
> over a style set under the latter, _as far as zstyle is concerned_.  (See
> pws's answer for the caveat.)
>
> > Using ctrl-x h after episodes on the command line it gives:
> >
> > tags in context :completion::complete:episodes::
> >     argument-rest  (_arguments _episodes)
> >
> > so I've tried:
> >   zstyle ' :completion::complete:episodes::'
> >
> > but still to no effect, and also the lack of * seems a little suspicious
>
> No, the lack of stars is expected.  What you put in zshrc is patterns; the
> completion system then looks up specific strings that the patterns are
> matched
> against.  The settings attached to the most specific pattern that matches
> are
> used.
>
> Minimal example:
>
> zshrc contains:
>
> % zstyle ':foo:bar' lorem yes
> % zstyle ':foo:*'   lorem no
>
> Then the foo subsystem might run, for example:
>
> % zstyle -t :foo:bar lorem && pwd
> /home/daniel
> % zstyle -t :foo:baz lorem && pwd
> %
>
> I take it the documentation of zstyle didn't make this clear, so could you
> suggest how to improve it?
>
> Cheers,
>
> Daniel
>


Messages sorted by: Reverse Date, Date, Thread, Author