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

Re: How to make underlining of a command line disappear after an ordinary key press? (2)

On Sat, 10 Oct 2009 15:07:42 -0700 (PDT)
Guido van Steen <gvsteen@xxxxxxxxx> wrote:
> I had actually tried that before, but I got: 
> "ordinary-key-press:2: job table full or recursion limit 
> exceeded" 

Are you sure you called .self-insert and not self-insert within the new
widget?  If you used self-insert the widget would call the function over
and over, with that error.  If you use .self-insert you're guaranteed
it's calling the internal widget and you can't get recursion.

> Moreover "zle -N self-insert ordinary-key-press"
> might bind some non-ordinary keys as well. 

You can check within the widget.  The string $KEYS contains the literal
keystrokes used to invoke the command.  Test with something like

if [[ $KEYS = [[:print:]] ]]; then
  # reset behaviour for any printable character
zle .self-insert

although of course it's up to you what keys to bind the special
behaviour too.

By the way, with space be sure it's not bound to magic-space.

Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/

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