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

Re: How to restart zle without invoking 'accept-line'?

On Nov 3,  7:53pm, Thiago Padilha wrote:
} I've tried to use the passthrough example from the keymap+widget tip you
} gave on the other thread:
} This works when I press enter(accept-line) but for ctrl+c I still need to
} press two times to restart zle.

I'm sorry, I hadn't fully comprehended that you were setting up to jump
directly into this from zle-line-init.

You can't actually restart zle from zle-line-init because, technically,
zle hasn't started *yet* at that point.  Send-break will interrupt
whatever zle-line-init is doing, but then you just fall on through to
the "instance" of zle that was already starting.

} If I bind 'recursive-edit-and-accept to a key and activate it outside
} zle-line-init, everything works as expected.

That is a clue to how you might make this work:

(1) bind recursive-edit-and-accept to a key string

(2) in zle-line-init, use "zle -U" to put that string on the input

This way, when zle-line-init ends, the first thing that will be run by
the editor is the command to switch to recursive-edit-and-accept.

By the way, you don't need to put the "zle -N ... end-recursive-edit"
inside the function body of recursive-edit-and-accept.  The zle -N may
be done just once, and keymap+widget will take care of the rest.

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