Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: compadd -Q -U completes $(( without inserting upon it
- X-seq: zsh-workers 37656
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: compadd -Q -U completes $(( without inserting upon it
- Date: Sun, 17 Jan 2016 16:21:48 +0100
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=Cz1KWimOYWM8MsvT86si9Kt7/2GE5mtxiTdk81hILwE=; b=vd4SmlOP7hvZjCAQBIKeNiJ0mtDHnfnW9mnGfLgGw7lnHaWp+wgDyGN6snfNnpno5y gUMHjPjwJvSHV4D4uAIhobXNxftZy0aDxSzWXfoeuDa1p+RfMCSeV/cajMrChZ+izTvt Q1S5KTP7/4RiyU77ILLSedPzbvrHCn5kkqUPNvoXcsgQD9DfL+OBAcvZmxO3l/r+xR4F 5tVMLnrS6VN5T7Dh/qGJoKKD7phrjCJPdOc6XrpHoohkG6oVNK0anLvD9S5WhLNp5v3E ECDTApxUwB36TN1lbLsVJqUY3CmugBWwtK0dcNqUGctap+5PS466o10+HZzY4JeZAzYX o6TA==
- In-reply-to: <160116145505.ZM6664@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVAGtkxB=QU8W_Uvy7msDqh82W-q78Cwp4uqW0op-VztxA@mail.gmail.com> <160116145505.ZM6664@torch.brasslantern.com>
On 16 January 2016 at 23:55, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> B) Don't invoke completion directly; instead, invoke a normal editing
> widget to modify the buffer so the tokens do not begin a context, then
> call the completion widget, and finally clean up the buffer again when
> the completion widget returns.
I went this path and it was quite easy. I have zew-complete-shell-word
widget (attached) that does a simple grep:
__zew_csw_found=(
"${(@M)historywords:#(#i)$__zew_csw_left*$__zew_csw_right}" )
then zle -M displays the results and Alt-h/H navigates among them. One
minute video:
https://asciinema.org/a/9smut3m7l6njvwfhrkfb6emdp
> The unfortunate bit of (B)
> is that it can't work at all as a completer function (zstyle element).
So no automatic multi-column zle -M, no actual highlighting (tried to
pass ANSI codes to zle -M but it doesn't process them), no zstyles
that configure pagination etc. These are the drawbacks? All this is in
the queue to implement, e.g. I currently display LINES / 3 matches and
there is no access to matches beyond that.
Code is at:
https://github.com/psprint/zsh-editing-workbench/blob/master/zew-complete-shell-word
only 74 lines for a robust _history_complete_older
Thanks,
Sebastian Gniazdowski
Attachment:
zew-complete-shell-word
Description: Binary data
Attachment:
zew-process-buffer
Description: Binary data
Messages sorted by:
Reverse Date,
Date,
Thread,
Author