Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Most minimal configuration challenge
Vincent Lefevre wrote on Mon, Sep 05, 2022 at 11:47:34 +0200:
> On 2022-09-04 06:42:24 +0000, Daniel Shahaf wrote:
> > Vincent Lefevre wrote on Fri, Sep 02, 2022 at 16:44:34 +0200:
> > > 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.
>
> This is still unclear. The zshcontrib(1) man page says:
>
> zstyle :bracketed-paste-magic paste-finish \
> quote-paste
> zstyle :bracketed-paste-magic:finish quote-style \
> qqq
>
> But I don't see why ":bracketed-paste-magic" is used in the first line
> instead of ":bracketed-paste-magic:*".
The context pattern must match the lookup's context. The lookup of the
paste-finish style in the bracketed-paste-magic plugin are under the
context ":bracketed-paste-magic". The pattern ":bracketed-paste-magic:*"
wouldn't match that context.
> Moreover, I don't see where the context "finish" is described in the
> man pages.
The context element "finish" is specific to the quote-paste helper
function. (That's perhaps not clear from the documentation.) The
possible values of that style are indeed undocumented. Bart?
> > > 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>».
>
> zstyle :vcs_info:<TAB>
>
> just gives
>
> Completing `context pattern' or `vcs'
>
Here it says «vcs» and offers the various valid values (plus or minus
quilt and hooks, but that's another story).
Under «zsh -f» the various valid values aren't completed until
vcs_info_printsys is callable. Running vcs_info once does the trick.
Presumably _zstyle should «autoload vcs_info_printsys» before calling it.
Could someone test this, please? (I'm ENOTIME.)
> This is not very informative. This is different from the man page,
> which says "vcs-string".
>
Again, I'm ENOTIME, but patches are welcome.
> zstyle :bracketed-paste-magic:<TAB>
>
> is even less informative:
>
> Completing `context pattern'
>
bracketed-paste-magic styles should /not/ be completed at this point.
Styles used by the quote-paste helper function /should/ be completed at
that point. So, the problem is just that _zstyle doesn't know about the
styles used by that helper function.
_zstyle could be taught about bracketed-paste-magic and quote-paste…
… but it doesn't scale for _zstyle to know about any random zstyle-using
thing. For instance, a third party plugin that looks up zstyles might
want implement completion for them. It'd be a lot easier to do that if
_zstyle would, say, delegate to «_zstyle-foo» for completion related to
contexts of the form (:foo|:foo:*), and that function were implemented
by by the foo (possibly third-party) plugin.
> With "ls -<TAB>", I get a list of possible options together with
> a short explanation. I would expect something like that with
> "zstyle :completion:<TAB>" rather than just a list of the possible
> completions.
Patches welcome. See _zstyle and _describe.
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author