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



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.

Oliver




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