Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Would like help with prompt
- X-seq: zsh-users 10278
- From: Kyrre Nygard <kyrreny@xxxxxxxxxxxx>
- To: Frank Terbeck <frank.terbeck@xxxxxxxxxxxxxx>, zsh-users@xxxxxxxxxx
- Subject: Re: Would like help with prompt
- Date: Thu, 18 May 2006 19:32:17 +0200
- In-reply-to: <20060518104456.GQ7968@xxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <7.0.1.0.2.20060518110006.0226ccf0@xxxxxxxxxxxx> <20060518093742.GP7968@xxxxxxxxxxxxxxx> <7.0.1.0.2.20060518122845.022675c8@xxxxxxxxxxxx> <20060518104456.GQ7968@xxxxxxxxxxxxxxx>
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