Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Make _expand_alias more usable as a completer
- X-seq: zsh-workers 49007
- From: Marlon Richert <marlon.richert@xxxxxxxxx>
- To: Oliver Kiddle <opk@xxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH] Make _expand_alias more usable as a completer
- Date: Fri, 4 Jun 2021 00:42:55 +0300
- Archived-at: <https://zsh.org/workers/49007>
- In-reply-to: <36227-1622676235.815398@zrY_.ZerV.zhJL>
- List-id: <zsh-workers.zsh.org>
- References: <CAHLkEDvg5-vdd_AHeiR9-TstXUh2-5j9yQNDns1mC2qR3zM_Tw@mail.gmail.com> <36227-1622676235.815398@zrY_.ZerV.zhJL>
On Thu, Jun 3, 2021 at 2:24 AM Oliver Kiddle <opk@xxxxxxx> wrote:
> In practical tests, I'm not finding that this works too well, it ends up
> removing the characters typed.
I cannot reproduce that. Here's what I tried:
% cd $(mktemp -d)
% print "PS1='%# ' PS2='' RPS2='< %^'\nsetopt transientrprompt" > .zshrc
% exec env -i HOME=$PWD TERM=$TERM zsh -d
% autoload -Uz compinit
% compinit
% _foo() {
compadd -QU 'ls -al'
compadd -Q lsusb lsvfs
}
% compdef _foo foo
% foo <tab>
% foo ls<tab>
ls -al lsusb lsvfs
It inserts the unambiguous prefix and cycles through the three
choices, without removing any characters I've typed. Am I missing
something?
> I also wonder if this would be better done from within _command_names
> directly but I'm not sure.
Actually, I feel like it could instead be added to the _expand
completer. Would that be a better idea than what I presented in this
patch? I could, for example, move the actual business logic for
expanding aliases from _expand_alias to _expand, and then have
_expand_alias call _expand to do the work.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author