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

Re: bad math expression error inside _pick_variant when running insert-all-matches for ls



On Tue, Sep 29, 2020 at 08:10:15AM +0200, Oliver Kiddle wrote:
> Bart Schaefer wrote:
> > I think the issue is that _insert_all_matches is expecting to be
> > called as a completer from inside _main_complete, not as a standalone
> > widget.
> 
> Yes, I think you're right.
> 
> > If we want _pick_variant to work in this context, we need PWS's patch,
> > but there may be other oddities as well.  Perhaps 20 years ago it was
> > OK to call _complete directly like that, but it's not OK any longer.
> 
> To create custom completion widgets that make use of the existing
> compsys system, bind to _generic and set the completer style.
> 
>   zstyle ':completion:all-matches::::' completer _all_matches _complete
>   zstyle ':completion:all-matches:*' old-matches true
>   zstyle ':completion:all-matches:*' insert true
>   zstyle ':completion:all-matches:*' file-patterns \
>       '%p:globbed-files' '*(-/):directories' '*:all-files'
>   zle -C all-matches complete-word _generic
>   bindkey '^Xx' all-matches
> 
> _generic dates to June 2000, _all_matches October of that year and my
> use of it, more-or-less like this, is the following year. I had zle -C
> directly binding _history before that but, as indicated in a comment, it
> was specifically designed to work either way. At some point I switched
> to using it via _generic too and that's what I'd recommend now.

Thanks! This code works without issues. But could zsh include such
a functionality itself, so that users need only to bind a key when they
want? This functionality helps me a lot, e.g. when removing system
packages sharing the same prefix.

BTW the mailing list archive seems not receiving any message after
Aug 2. (I was trying to keep a reference to your message.)

-- 
Best regards,
lilydjwg




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