From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19367 invoked by alias); 23 Sep 2013 21:02:45 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17992 Received: (qmail 25625 invoked from network); 23 Sep 2013 21:02:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <130923130204.ZM20058@torch.brasslantern.com> Date: Mon, 23 Sep 2013 13:02:04 -0700 In-reply-to: Comments: In reply to Larry Schrof "Colored-character displayed on CTRL-C ?" (Sep 23, 5:37pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: "zsh-users@zsh.org" Subject: Re: Colored-character displayed on CTRL-C ? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Sep 23, 5:37pm, Larry Schrof wrote: } } Recent versions of bash have this very nifty feature where, when you } hit CTRL-C to terminate a command line and get a new prompt on a new } line, something like ^C with a yellow background is displayed to help } remind you that the command is not actually executed. This should do it for you: autoload -Uz colors colors handle-interrupt() { print -n "$bg_bold[yellow]${(V)KEYS:-^C}$reset_color" zle -I && zle .kill-buffer } zle -N handle-interrupt TRAPINT() { zle && zle handle-interrupt } You might also want to bindkey ^G handle-interrupt to replace the built-in binding for send-break, but this behaves a bit differently than send-break in some situations so use with caution. The use of kill-buffer also pushes the line onto the kill ring, so you can get it back with ^Y after interrupting it. Perhaps that's a feature.