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

Re: Prompt coloring question



On Sun, Jul 13, 2008 at 04:23, Phil Pennock
<zsh-workers+phil.pennock@xxxxxxxxxxxx> wrote:

> Define invert?  The sequence you provide is a reset to default and
> normal red text, so you'll need to be clearer about what you want and
> what you tried, instead of what you started from.

I want to use %S and %s to invert the user name so I know I am on a
remote system. While I can easily invert other colors, like light green
( $'%{\e[1;32m%}' ), I can't invert red.


> In my terminal (not the same as what you're using):
> "negative image + red display", $'%{\e[7;31m%}' works for me.
> "red background", $'%{\e[0;41m%}' works for me.

I want to dynamically switch back and forth based on if I am using
SSH to keep an already cluttered prompt setting at least a bit
readable. In case anyone is interested & wants to steal (it is even
girlfriend-compatible(!)):

[ $SSH_TTY ] && ZSHRC_PARENT_SSH=1
[ $WINDOW  ] && ZSHRC_PARENT_SCREEN=1
PROMPT=''
[ $ZSHRC_PARENT_SSH ] && PROMPT+="%S"
[ $USER = 'ilona' ] &&
PROMPT+="%(!.$fg_red%m.$fg_light_purple%n@%m)$fg_no_colour" ||
PROMPT+="%(!.$fg_red%m.$fg_light_green%n@%m)$fg_no_colour"
[ $ZSHRC_PARENT_SSH ] && PROMPT+="%s"
[ $ZSHRC_PARENT_SCREEN ] && PROMPT+="$fg_light_yellow [$WINDOW]"
PROMPT+="$fg_light_blue %~ %# $fg_no_colour"


Thinking about it, this might be a good time to switch to the 'new'
colour handling stuff zsh offers..


Richard



Messages sorted by: Reverse Date, Date, Thread, Author