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

Re: Colored-character displayed on CTRL-C ?



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