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

Re: Colored PS1

* 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]
|     [...]
|     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,

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

Attachment: pgp2DuEfS8WFO.pgp
Description: PGP signature

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