zsh-users
 help / color / mirror / code / Atom feed
From: Simon Ruderich <simon@ruderich.org>
To: zsh-users@sunsite.dk
Subject: Re: Append cancelled commands to history
Date: Fri, 19 Sep 2008 18:20:45 +0200	[thread overview]
Message-ID: <20080919162045.GA22435@ruderich.org> (raw)
In-Reply-To: <c16a574a0809181450t61a5b5ddq2e80797fde37636e@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 752 bytes --]

On Thu, Sep 18, 2008 at 11:50:42PM +0200, thomasg wrote:
> Hello list,
>
> I was curious if it's possible to append canceled (CTRL+C) commands to the
> histfile.
> In case there is not yet a function to do this, is it generally possible to
> bind CTRL+C to a custom function?
>
> Greetings,
>
> thomasg

Hi,

I'm using the following function which works fine for me, not sure though if
it's the best solution:

    TRAPINT() {
        # Store the current buffer in the history.
        zle && print -s $BUFFER

        # Return the default exit code so zsh aborts the current command.
        return $1
    }

Hope this helps,
Simon
-- 
+ privacy is necessary
+ using http://gnupg.org
+ public key id: 0x6115F804EFB33229

[-- Attachment #2: Type: application/pgp-signature, Size: 194 bytes --]

  reply	other threads:[~2008-09-19 16:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-18 21:50 thomasg
2008-09-19 16:20 ` Simon Ruderich [this message]
2009-07-06 15:16   ` Re[2]: " Vadim Zeitlin
2009-07-06 15:43     ` Nadav Har'El
2009-07-06 15:53       ` Nadav Har'El
2010-03-15 16:42         ` Nadav Har'El
2010-03-20 17:50           ` Bart Schaefer
2010-03-22  8:42             ` Nadav Har'El
2010-03-22 15:07               ` Bart Schaefer
2010-03-24 10:27                 ` Nadav Har'El
2010-03-24 16:19                   ` Bart Schaefer
2010-03-26 20:23                     ` Nadav Har'El
2010-03-27  4:23                       ` Bart Schaefer
2010-04-05 19:36       ` Simon Ruderich
2009-07-07 19:49     ` Simon Ruderich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080919162045.GA22435@ruderich.org \
    --to=simon@ruderich.org \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).