Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Prompt exit code return
On Jul 14, 4:51pm, Andrei Onoie wrote:
}
} I want for %# to be red if exit code != 0 only after the command is
} finished,and then after I hit return it is green again...
It occurs to me to wonder: My previous response only deals with
making the prompt look green when you hit return on an empty buffer.
Is it possible that you actually want the exit status ($?) reset to
zero instead?
That's a bit more difficult, because you have to actually execute a
command in the normal execution flow (i.e., not inside preexec or
precmd) to get the status to change. Which means you probably want
to keep it from being entered into the history, etc.
The pieces are all there to accomplish it; override the accept-line
widget to convert an empty buffer into a ":" command, install a
zshaddhistory function to discard it, etc. -- but it's convoluted
to get it right.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author