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

Re: [PATCH] Make _expand handle aliases (was Re: [PATCH] Make _expand_alias more usable as a completer)



On Fri, Apr 1, 2022 at 3:37 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> I'm uncomfortable with the change that expanding aliases in command
> position is the default behavior of _expand.  It never did this
> before.  It means that if there is an alias that is the prefix of
> another command name, expanding that alias will take precedence over
> completing the suffix, which i think is an undesirable effect as a new
> default.

Yes, I agree; that is indeed a problem. I hadn't considered that.

> Furthermore, the behavior is a bit odd.  With the patch, given an
> alias named "xyz", and completer style _expand _complete, if you type
> TAB after "xy" you get "xyz " (with trailing space).  Since TAB after
> "xyz" yields the the value of the alias, the added space feels wrong;
> the first TAB should stop before the space is appended so a second TAB
> can do the expanding.  Perhaps there's a combination of the supported
> styles that provides this behavior, I didn't dig into it very far.

I don't like the way the space is added either, but it worked like
that before, too. I didn't want to change the logic. I think that's
better left to a separate patch.

In any case, perhaps moving alias expansion into _expand is not such a
good idea after all. I suppose it's better to be offered as part of
completing aliases, but listed separately, after the actual alias
completions.

Would it make more sense to fold alias expansion into _aliases?




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