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

Re: Cancel zle -M on a keypress, use cursor keys



On 18 January 2016 at 18:34, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> I think you want to invoke "zle recursive-edit" with its own private
> keymap.

This was quite easy, this is nearly the whole code required (the rest
is first_call initialization):

+if (( first_call ));then
+    zle recursive-edit -K main
+    zle -M ""
+fi

It gives a special mode exited by e.g. enter key, what's signalized by
zle -M "". I had to use $first_call variable because LASTWIDGET is
left unchanged (and points to e.g. vi-backward-char) when
zew-history-complete-word is called for the second time, i.e. right
after zle recursive-edit.

> The other way is to use "read -k" in in a loop, for which the most
> detailed (though now fairly old and probably improvable) example is
> Functions/Zle/incremental-complete-word.

This might be better because now zle -M "...\n...\n..." gives blinks
(when holding "next entry" key).That's maybe connected to keyboard
usage, as I did a short test: called zew-history-complete-word 1000
times recursively, and zle -M "...\n...\n..." didn't blink then. read
-k might change how keys influences the display. Or maybe it's because
that currently the widget exits after each recognized keystroke, but
not sure how this could influence zle -M.

Best regards,
Sebastian Gniazdowski



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