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

Re: Would like help with prompt



At 12:44 18.05.2006, Frank Terbeck wrote:
Kyrre Nygard <kyrreny@xxxxxxxxxxxx>:
> At 11:37 18.05.2006, Frank Terbeck wrote:
> >I'd really check if 'colors' wouldn't do:
> >
> >[snip]
> >  % print -l $color | sort | column
> >  00              32              44              cyan
[...]
> >[snap]
>
> Cool stuff, thanks man!
>
> Although, what does each column represent?

That's just a representation of an associative array.
See 'man zshcontrib'. And try:

% autoload colors ; colors
% print $fg[red]$bg[white]Hello World.
% PS1="%{${fg[yellow]}%}%/ %{${fg[default]}%}%# "

Regards, Frank

I came up with this elegant approach thanks to Dan Nelson
from the FreeBSD mailinglist:

if [[ $USER == root ]] ; then

        a1="%{$fg_bold[cyan]%}"
        a2="%{$fg_no_bold[cyan]%}"
        a3="%{$fg_bold[black]%}"

else

        a1="%{$fg_bold[red]%}"
        a2="%{$fg_no_bold[red]%}"
        a3="%{$fg_bold[black]%}"

fi

PROMPT="$a1($a2%n$a3@$a2%m$a1)($a2%D{%H:%M}$a3+$a2%D{%d/%m}$a1)"$'\n'
PROMPT+="$a1($a2%#$a3:$a2%~$a1) %{$reset_color%}"

Nice isn't it?

All the best,
Kyrre



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