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

Re: Most minimal configuration challenge



Vincent Lefevre wrote on Fri, Sep 02, 2022 at 16:44:34 +0200:
> On 2022-09-02 09:26:40 +0000, Daniel Shahaf wrote:
> > Vincent Lefevre wrote on Wed, Aug 31, 2022 at 11:28:31 +0200:
> > > On 2022-08-28 18:29:27 +0000, Daniel Shahaf wrote:
> > > > zstyle has been explained multiple times in the past so you might want
> > > > to look those up and ask about parts that are unclear to you.
> > > > 
> > > > In short, «zstyle ':foo:bar:*:baz' key v1 v2» translates as "When
> > > > library foo asks for the value of key in a situation of the form
> > > > bar:*:baz, tell it the answer is «v1 v2»".
> > > 
> > > Perhaps there should be a zsh function that translates a zstyle line
> > > to plain English. :-)
> > 
> > What do you have in mind, exactly?  It'd be pretty easy to write
> > something that, say, runs «zstyle -L» and applies the sh-to-English
> > mechanical transformation I did above.  That's just a compiler…
> 
> The above is not very helpful for the end user.
> 
> For instance, "zstyle -L" gives in particular:
> 
>   zstyle :urlglobber url-local-schema ftp file
>   zstyle ':url-quote-magic:*' url-metas '*?[]^(|)~#{}='
> 
> but I can't find any explanation about why it should be ":urlglobber"
> and not something else. The man page looks similar for urlglobber and
> url-quote-magic, though they look different above.
> 

By convention, context patterns are of the form «:foo:…» where «foo»
identifies a particular library / module / plugin for namespacing
reasons.  So, it says ":urlglobber" and not something else because
that's what the author of urlglobber named urlglobber.

> In the zshmodules(1) man page:
> 
>   For  example,  a  fictional  `weather' plugin might state in its
>   documentation that it looks up the preferred-precipitation style
>   under the `:weather:continent:day-of-the-week:phase-of-the-moon'
>   context.  According to this, you might set the following in your
>   zshrc:
> 
>     zstyle ':weather:europe:*' preferred-precipitation rain
>     zstyle ':weather:*:Sunday:*' preferred-precipitation snow
> 
> So I would expect the translator to mention "continent",
> "day-of-the-week" and "phase-of-the-moon" in its output.

The zstyle completion actually does this; try completing
«zstyle :vcs_info:<TAB>» or «zstyle :completion:<TAB>».

> Moreover, for ':completion:*', it is difficult to find the associated
> documentation, because if one searches for "completion" in the zshall
> man page, one gets too many matches.

In this case the best approach is to look for the style name.  In other
formats of the manual, each style name has its own index entry.

----

Potentially some of the above should be added to the manual.

Daniel
(I might not have time this morning to reply to all threads I participated in)




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