From: Pier Paolo Grassi <pierpaolog@gmail.com>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: Zsh-Users List <zsh-users@zsh.org>
Subject: Re: problem with context specification
Date: Tue, 14 Jan 2020 16:59:58 +0100 [thread overview]
Message-ID: <CAP+y1xBeceLSxP-8HRcRBGhiF_irSA676N-Mt72DE-LOySjaiw@mail.gmail.com> (raw)
In-Reply-To: <20200113170630.GA8134@tarpaulin.shahaf.local2>
[-- Attachment #1: Type: text/plain, Size: 3914 bytes --]
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@daniel.shahaf.name> 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
>
next prev parent reply other threads:[~2020-01-14 16:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200113164758eucas1p17ea364450eec705f49edaa8fb69fa65b@eucas1p1.samsung.com>
2020-01-13 16:46 ` Pier Paolo Grassi
2020-01-13 16:56 ` Peter Stephenson
2020-01-13 17:46 ` Mikael Magnusson
2020-01-14 11:52 ` Peter Stephenson
2020-01-13 17:53 ` Bart Schaefer
2020-01-13 17:06 ` Daniel Shahaf
2020-01-13 17:41 ` [PATCH] docs: Add an example of setting and querying zstyles (was: Re: problem with context specification) Daniel Shahaf
2020-01-14 15:59 ` Pier Paolo Grassi [this message]
2020-01-14 16:45 ` problem with context specification Daniel Shahaf
2020-01-14 17:55 ` Pier Paolo Grassi
2020-01-14 18:05 ` Peter Stephenson
2020-01-14 18:34 ` Bart Schaefer
2020-01-14 18:50 ` Daniel Shahaf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAP+y1xBeceLSxP-8HRcRBGhiF_irSA676N-Mt72DE-LOySjaiw@mail.gmail.com \
--to=pierpaolog@gmail.com \
--cc=d.s@daniel.shahaf.name \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).