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

Re: Getting back a command after hitting CTRL-C



On Tue, Jun 17, 2008 at 02:28:42PM +0200, Mikael Magnusson wrote:
> 2008/6/17 Richard Hartmann <richih.mailinglist@xxxxxxxxx>:
> > On Tue, Jun 17, 2008 at 14:12, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> >
> >
> >> Bind kill-whole-line to some key and press that instead of ctrl-c, then
> >> you can get it back with a yank. If you have a hard time not pressing ctrl-c,
> >> try:
> >> trap true SIGINT
> >
> > 5 minutes with the trap show I can't cope with that enabled :p
> > Unfortunately, binding kill-whole-line to ^c does not work, so that is not
> > an option either.
> 
> Well, that is the idea, every time it annoys you, you remember to use
> the other keybinding instead :). You can of course change the interrupt
> key with stty, but then you won't be able to interrupt actual commands with
> ctrl-c anymore.
[...]

which you could work around with some precmd/prexec hook I
suppose.

This seems to work:

trap 'zle kill-buffer; zle -R' INT

-- 
Stéphane



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