Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Colored-character displayed on CTRL-C ?
- X-seq: zsh-users 17994
- From: Hauke Petersen <hkptrsn@xxxxxxxxx>
- To: "zsh-users@xxxxxxx" <zsh-users@xxxxxxx>
- Subject: Re: Colored-character displayed on CTRL-C ?
- Date: Mon, 23 Sep 2013 23:36:19 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=zo/DAGgYIVQDN3x6rvz3j7jqXKxjRb5RTgFL7Nea9Uk=; b=B26UtMqL+BTdv7EW+rPy8ubI2BnXs/2C24WrPsi129WhwBIb81OFikWO4qWdlb9Xh6 608nVifHl2FyfXcWZAHapZKHYHeRr4OP1s/tD6Jyg+3dx6rG8D3lRg2F6If7ojMADvtg S8XsPs/fW851wbF5IMgXbxXktft+4O104isX+muuUKx8CwC6Qss0ocAFPHrk8y90ayG5 HLDcF7xmiSez1Z8n/0QShLT3zUxeP+7fXLE/tmkTVVXOZRBxtOBqeT893BfSm124050d o8JbLWAhvPsHH9QiDTUXnoglI5FoCMqiXNO/Q12SMFr0Vqq6KANIc+ZZUV+3b485kGM8 2ysw==
- In-reply-to: <CE65CA5F.235C2%larrys@fb.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CE65CA5F.235C2%larrys@fb.com>
On Mon, Sep 23, 2013 at 7:37 PM, Larry Schrof <larrys@xxxxxx> wrote:
> I'd really like ideas on the best way to tell zsh to display a
> character with a yellow background on CTRL-C, followed by taking
> me to a new prompt on the next line.
One attempt:
[[ -o interactive ]] && function TRAPINT {
zle && print -nP '%B%S^C%s%b'
return $(( 128 + $1 ))
}
`[[ -o interactive ]]' is to only define the trap in interactive
shells. `zle && ...' to only print ^C when the line editor is active.
`print -P' interprets prompt escape codes. %B and %b mark bold, %S and
%s standout/invert. That's the same format as the default
PROMPT_EOL_MARK. You can find other formatting options (prompt
escapes) in zshmisc(1).
--
[Resending this, evil gmail tried to keep it off the list.]
Messages sorted by:
Reverse Date,
Date,
Thread,
Author