Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Conditional newline in prompt
- X-seq: zsh-users 15584
- From: Christoph Wurm <christoph@xxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Conditional newline in prompt
- Date: Wed, 01 Dec 2010 21:42:11 +0100
- 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
Hello,
I would like to display the exit code of a command if it is not 0 on a
line of its own, followed by the prompt on the next line.
Is this possible?
I was able to come up with the following:
PROMPT="%0(?..%?)
%{$fg[green]%}%n@%m%{$reset_color%}:%~ %{$fg[red]%}%#%{$reset_color%} "
However, this prints a newline after every command. Is there some
equivalent of '\n' that can be used inside the conditional substring? Or
some other way to do this?
Kind regards
Christoph
Messages sorted by:
Reverse Date,
Date,
Thread,
Author