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

Re: [PATCH] Make _expand_alias more usable as a completer

On 29 May, Marlon Richert wrote:
> When _expand_alias is invoked as a completer, if 'complete' is set to
> 'true', let _expand_alias always return 1. This is analogous to how
> this style behaves when _expand_alias is invoked as a widget or when
> the _expand completer's 'accept-exact' style is set to 'continue',
> which allows you to put it at the start of the 'completer' list.

In practical tests, I'm not finding that this works too well, it ends up
removing the characters typed. From _expand_aliases, you end up with a
call to compadd -QU and later you get a compadd -Q. For testing play
around with the following:

  _foo() {
    compadd -QU 'ls -al'
    compadd -Q lsusb lsvfs
  compdef _foo foo
  foo ls<tab>

I can see the motivation for the feature but it needs compstate[insert]=menu
to be usable, at least from my setup. Setting that tends to be applicable
wherever you're using -U to change what was typed so far.

It feels like a bug that this example can't recognise the unambiguous
"ls" prefix but aliases often expand to something quite different to the
initial alias name.

I also wonder if this would be better done from within _command_names
directly but I'm not sure.


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