From: Meino Christian Cramer <Meino.Cramer@gmx.de>
To: zsh-users@sunsite.dk
Subject: Colored PS1
Date: Wed, 07 Sep 2005 05:25:42 +0200 (CEST) [thread overview]
Message-ID: <20050907.052542.74749449.Meino.Cramer@gmx.de> (raw)
Hi,
from the german version of the zsh-lovers page I got the following
hint to colorise the prompt of the shell:
autoload -U colors && colors
echo "$fg_bold[red]zsh $fg_no_bold[white]is $bg[blue]$fg_bold[green]nice"
which prints a colored string. So far so nice.
Now I thought my previous PS1-string
export PS1="%B%(?..[%?] )%b%n@%U%m%u:%1~>"
would be nicer if I would change it to:
export PS1="%B%(?..[%?] )$fg_bold[red]%b$fg_no_bold[black]%n@%U%m%u:%1~>"
but this does not work for me. The prompt remains the same but
expansion/expanding on the commandline gets a hickup. My TERM is set
to "xterm" and normally colored output is no problem.
What is wrong in my assumption, that first the $fg_bold[red] and
$fg_no_bold[black] get expanded to their "real" escape sequences and
then and thing like %b get replaced by their current value and then
the string is sent to the terminal which finally colors the output
accordingly?
If I do a
echo $PS1"
I get a correctly colored output (the special expanding of for
example %b is missing then, which is ok).
Hmmm....?
Thank you very much for any help in advance !
Have a nice week!
Meino
next reply other threads:[~2005-09-07 3:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-07 3:25 Meino Christian Cramer [this message]
2005-09-07 7:53 ` Tim Kruse
2005-09-07 14:57 ` Bart Schaefer
2005-09-07 17:21 ` Meino Christian Cramer
2005-09-08 2:39 ` Bart Schaefer
2005-09-08 3:31 ` Meino Christian Cramer
2005-09-08 16:05 ` Bart Schaefer
2005-09-08 16:59 ` Meino Christian Cramer
2005-09-09 14:32 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050907.052542.74749449.Meino.Cramer@gmx.de \
--to=meino.cramer@gmx.de \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).