zsh-users
 help / color / mirror / code / Atom feed
From: Tim Kruse <irrlicht2c@gmx.net>
To: zsh-users@sunsite.dk
Subject: Re: Colored PS1
Date: Wed, 7 Sep 2005 09:53:01 +0200	[thread overview]
Message-ID: <qri2v2-n14.ln1@news.irrlicht.homelinux.net> (raw)
In-Reply-To: <20050907.052542.74749449.Meino.Cramer@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 1277 bytes --]

* On 07.09.2005 Meino Christian Cramer wrote:

>      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.

 You should enclose your color definitions between '%{' and '%}'

 From the manual page:

,-----[man zshall]
| PROMPT EXPANSION
|     [...]
|     Visual effects
|         [...]
|         %{...%}
|               Include a string as a literal escape sequence.  The  string  within
|               the  braces should not change the cursor position.  Brace pairs can
|               nest.
`-----

 Try something like this

% ps_beg="%B%{$fg_bold[red]%}%(?..[%?] )%b%{$fg_no_bold[black]%}%n@%U%m%u:"
% ps_end="%1~>%{$fg_bold[default]$fg_no_bold[default]%}"
% export PS1="${ps_beg}${ps_end}"

 I don't know if "%fg_bold[default]$fg_no_bold[default]" is
really necessary here ...

 Btw, %b you mentioned is the end of bold output. See also the
manual page (man zshmisc search for PROMPT EXPANSION)

 So long,
tkr

-- 
*** Topic for #redhat:  ReDHaT is the answer to all your problems. It
    could be the start too!

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2005-09-07  8:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-07  3:25 Meino Christian Cramer
2005-09-07  7:53 ` Tim Kruse [this message]
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=qri2v2-n14.ln1@news.irrlicht.homelinux.net \
    --to=irrlicht2c@gmx.net \
    --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).