* Coolest prompt?
@ 2004-06-11 10:29 Ziggy
2004-06-11 12:07 ` Thomas Köhler
` (5 more replies)
0 siblings, 6 replies; 9+ messages in thread
From: Ziggy @ 2004-06-11 10:29 UTC (permalink / raw)
To: L:ZSH-users
ZSH allows the user to create interesting prompts. Time displaying, menu bars
and colors.
Post your prompt (and .zshrc) here.
Mine is a rather simple one:
adi@omega ~ % 1:27PM Fri
My zshrc::
alias d="ls --color"
alias ls="ls --color=auto"
alias ll="ls --color -lh"
alias nano="nano -w"
alias "nano --override"="nano"
alias BitchX="BitchX dushkinup"
autoload -U compinit promptinit
compinit
promptinit; prompt gentoo
RPROMPT=' %B%@%b %U%D{%a}%u'
prompt="{%U%n#%l@%m:%h%u} %30<...<%~%#"
chpwd() {
[[ -t 1 ]] || return
if [[ -n $xterm_prompt ]] {
print -Pn "\e]2;${USER}@${HOST}:%~\a"
}
}
--
Linux
2.6.6
(Gentoo)
i686 P4
Men occasionally stumble over the truth, but most of them pick themselves
up and hurry off as if nothing had happened.
-- Winston Churchill
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Coolest prompt?
2004-06-11 10:29 Coolest prompt? Ziggy
@ 2004-06-11 12:07 ` Thomas Köhler
2004-06-11 21:20 ` Aaron Davies
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Thomas Köhler @ 2004-06-11 12:07 UTC (permalink / raw)
To: Ziggy; +Cc: L:ZSH-users
[-- Attachment #1: Type: text/plain, Size: 865 bytes --]
Ziggy wrote:
> ZSH allows the user to create interesting prompts. Time displaying, menu bars
> and colors.
Of course :)
> Post your prompt (and .zshrc) here.
>
> Mine is a rather simple one:
> adi@omega ~ % 1:27PM Fri
See the following screenshot for mine:
http://gott-gehabt.de/800_wer_wir_sind/thomas/Homepage/pics/prompt.png
(Colour doesn't display well in email ;-)
> My zshrc::
[snip]
Mine is here:
http://gott-gehabt.de/800_wer_wir_sind/thomas/Homepage/Computer/zsh/zshrc
It's a bit long to post here :-)
Ciao,
Thomas
--
Thomas Köhler Email: jean-luc@picard.franken.de
<>< WWW: http://jeanluc-picard.de
IRC: tkoehler
PGP public key available from Homepage!
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Coolest prompt?
2004-06-11 10:29 Coolest prompt? Ziggy
2004-06-11 12:07 ` Thomas Köhler
@ 2004-06-11 21:20 ` Aaron Davies
2004-06-11 22:34 ` William Scott
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Aaron Davies @ 2004-06-11 21:20 UTC (permalink / raw)
To: zsh-users
Mine currently says
91.0 F Aaron-Davies-Computer~ :) %
the relevant zprofile line is
export PS1='`cat /tmp/temperature`'" %m%~ %(0?.:).:() %# "
but the real magic is in my crontab:
*/15 * * * * curl -s
http://weather.noaa.gov/weather/current/KSDF.html | grep 'F (' | head
-n 1 | awk '{print $3 " " $4}' > /tmp/temperature
I got both "cute" ideas (the temp and the return-code smilies) from
Slashdot discussions on prompt strings.
On Friday, June 11, 2004, at 06:29 AM, Ziggy wrote:
> ZSH allows the user to create interesting prompts. Time displaying,
> menu bars
> and colors.
>
> Post your prompt (and .zshrc) here.
>
> Mine is a rather simple one:
> adi@omega ~ % 1:27PM
> Fri
>
> My zshrc::
>
> alias d="ls --color"
> alias ls="ls --color=auto"
> alias ll="ls --color -lh"
> alias nano="nano -w"
> alias "nano --override"="nano"
> alias BitchX="BitchX dushkinup"
> autoload -U compinit promptinit
> compinit
> promptinit; prompt gentoo
>
> RPROMPT=' %B%@%b %U%D{%a}%u'
> prompt="{%U%n#%l@%m:%h%u} %30<...<%~%#"
>
> chpwd() {
> [[ -t 1 ]] || return
> if [[ -n $xterm_prompt ]] {
> print -Pn "\e]2;${USER}@${HOST}:%~\a"
> }
> }
>
> --
> Linux
> 2.6.6
> (Gentoo)
> i686 P4
>
>
> Men occasionally stumble over the truth, but most of them pick
> themselves
> up and hurry off as if nothing had happened.
> -- Winston Churchill
>
>
--
__ __
/ ) / )
/--/ __. __ ______ / / __. , __o _ _
/ (_(_/|_/ (_(_) / (_ /__/_(_/|_\/ <__</_/_)_
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Coolest prompt?
2004-06-11 10:29 Coolest prompt? Ziggy
2004-06-11 12:07 ` Thomas Köhler
2004-06-11 21:20 ` Aaron Davies
@ 2004-06-11 22:34 ` William Scott
2004-06-15 15:18 ` Julius Plenz
2004-06-17 17:50 ` Sami Samhuri
` (2 subsequent siblings)
5 siblings, 1 reply; 9+ messages in thread
From: William Scott @ 2004-06-11 22:34 UTC (permalink / raw)
To: Ziggy; +Cc: ZSH-users
My prompt:
%
I'm running on OS X, which includes zsh as one of its three default
shells (the others are bash and tcsh). I keep the prompt simple and
put the information in the title bar of the terminal window where it is
dynamically updated. I use a terminal program called iTerm which has
tabs. I also update the labels of the tabs dynamically. I've made a
number of customizations that might be of use to other OS X zsh users.
These can be found on my zsh slobbering proselytization page and links
therein: http://tinyurl.com/3373b
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Coolest prompt?
2004-06-11 22:34 ` William Scott
@ 2004-06-15 15:18 ` Julius Plenz
2004-06-17 12:25 ` Vincent Lefevre
0 siblings, 1 reply; 9+ messages in thread
From: Julius Plenz @ 2004-06-15 15:18 UTC (permalink / raw)
To: ZSH-users
* William Scott <wgscott@chemistry.ucsc.edu> [2004-06-12 00:50]:
> My prompt: %
Well,...
> I keep the prompt simple
I see. I also like simple prompts, but a _bit_ more infos are ok. ;-)
Therefore my prompt looks like this (relevant parts, be careful with wraps):
precmd () {
TMPPATH=" "$PWD
SHORTPATH=${(M)TMPPATH%???????????}
PS1=$(echo "%{\033[0;36m%}$SHORTPATH%{\033[0m%},%{\033[0;31m%}%j%{\033[0m%}%% ")
}
To see this Prompt in action, look at this example:
e/www/plenz,0% cd www/
w/plenz/www,0% cd plenz.com/
w/plenz.com,0% cd /tmp
/tmp,0% sleep 10&
[1] 16056
/tmp,1% cd
[1] + 16056 done sleep 10
e/www/plenz,0%
So, you see, there is a fixed path-length and the number of
background jobs. I really like this prompt, its simple but gives
enough information.
Julius
--
www.plenz.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Coolest prompt?
2004-06-15 15:18 ` Julius Plenz
@ 2004-06-17 12:25 ` Vincent Lefevre
0 siblings, 0 replies; 9+ messages in thread
From: Vincent Lefevre @ 2004-06-17 12:25 UTC (permalink / raw)
To: ZSH-users
On 2004-06-15 17:18:40 +0200, Julius Plenz wrote:
> To see this Prompt in action, look at this example:
>
> e/www/plenz,0% cd www/
> w/plenz/www,0% cd plenz.com/
> w/plenz.com,0% cd /tmp
> /tmp,0% sleep 10&
> [1] 16056
> /tmp,1% cd
> [1] + 16056 done sleep 10
> e/www/plenz,0%
>
> So, you see, there is a fixed path-length and the number of
> background jobs. I really like this prompt, its simple but gives
> enough information.
You could avoid to write ",0" when there are no background jobs.
Here's my prompt code:
setopt PROMPT_SUBST
setopt PROMPT_PERCENT
zmodload -i zsh/parameter
precmd()
{
local njobs
if [[ $domain == local.ay && "$(pmu_battery)" == "Battery" ]] then
psvar[1]="[$(pmu_percent)%]"
else
psvar[1]=""
fi
njobs=$#jobstates;
case $njobs in
0) psvar[2]=();;
1) psvar[2]="1 job";;
*) psvar[2]="$njobs jobs";;
esac
[[ -n $TTY && $TERM == (xterm*|dtterm|rxvt|screen*) ]] &&
{
print -nP "\e]1;%m:%.\x07"
print -nP "\e]2;%(2v. %2v |.)${WINTITLE:+ $WINTITLE |} %n@%m - %~ | %y"
[[ $TERM == screen* ]] && print -n .
print -n "\x07"
} > $TTY
}
TRAPCLD() { [[ -o interactive && -n $TTY ]] && precmd }
putprompt()
{
local preprompt postprompt prefail postfail
if [[ -n $COLORTERM ]] then
local bgcol=`tput setab 0`
preprompt="%{`tput bold`$bgcol%(2v.`tput setaf 2`.`tput setaf 3`)%}"
postprompt="%{`tput sgr0`%}"
prefail="%{`tput setab 1`%}"
postfail="%{$bgcol%}"
fi
PS1="%m:%20<...<%~%<<%(?..${prefail}[%?]${postfail})%1v%(#.#.>) "
RPS1="<%*"
PS1="$preprompt$PS1$postprompt"
RPS1="$preprompt$RPS1$postprompt"
PS2="$preprompt$PS2$postprompt"
PS3="$preprompt$PS3$postprompt"
PS4="$preprompt$PS4$postprompt"
}
putprompt
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% validated (X)HTML - Acorn / RISC OS / ARM, free software, YP17,
Championnat International des Jeux Mathématiques et Logiques, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Coolest prompt?
2004-06-11 10:29 Coolest prompt? Ziggy
` (2 preceding siblings ...)
2004-06-11 22:34 ` William Scott
@ 2004-06-17 17:50 ` Sami Samhuri
2004-06-18 16:08 ` Sartoo
2004-07-08 1:15 ` Geoff Wing
5 siblings, 0 replies; 9+ messages in thread
From: Sami Samhuri @ 2004-06-17 17:50 UTC (permalink / raw)
To: L:ZSH-users
[-- Attachment #1: Type: text/plain, Size: 930 bytes --]
* It was Fri, Jun 11, 2004 at 01:29:45PM +0300 when Ziggy said:
> ZSH allows the user to create interesting prompts. Time displaying, menu bars
> and colors.
>
> Post your prompt (and .zshrc) here.
Mine is quite simple, but I find it to be useful without cluttering up
my terminal.
sjs@diavolo ~ % grep PROMPT .zshrc
# PROMPT SUBTITUTION
export PROMPT=$'%(?..%{\e[41;38m%}%B-%?-%b%{\e[0m%} )%(1j.%{\e[01;33m%}[%j] .)%{\e[01;36m%}%n@%m%{\e[0m%} %{\e[01;32m%}%2~%{\e[0m%} %B%#%b '
export RPROMPT=$'%{\e[01;31m%}[%!]%{\e[0m%}' # history # on right
It ends up looking like the above, however when there are jobs running
it prepends [N] in yellow, where N is the number of jobs running. If the
exit code of the previous command was non-zero in white on red it
displays -$?- before the prompt. Where ~ is above it displays 2
directories of $PWD. (eg. ~/devel or kernel/linux-2.6.7-rc3-mm1)
--
Sami Samhuri
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Coolest prompt?
2004-06-11 10:29 Coolest prompt? Ziggy
` (3 preceding siblings ...)
2004-06-17 17:50 ` Sami Samhuri
@ 2004-06-18 16:08 ` Sartoo
2004-07-08 1:15 ` Geoff Wing
5 siblings, 0 replies; 9+ messages in thread
From: Sartoo @ 2004-06-18 16:08 UTC (permalink / raw)
To: L:ZSH-users
* Ziggy wrote:
> ZSH allows the user to create interesting prompts. Time displaying, menu bars
> and colors.
Yes, that's a nice feature. :)
> Post your prompt (and .zshrc) here.
> Mine is a rather simple one:
> adi@omega ~ % 1:27PM Fri
I prefer this one:
sartoo: \> cd /usr/share/zsh/4.2.0/functions/ /home/sartoo [61,69]
sartoo: \> cd /root ...0/functions [7,0]
cd: permission denied: /root
sartoo: \> su (1) ...0/functions [7,0]
root@mdk01 /> /root [19,22]
^ ^
Number of dirs in $PWD -| |
Number of files in $PWD -|
and here is the associated part of my ~/.zshrc
,-----[» ~/.zshrc «]--
| precmd () {
| FILE=$(find . -maxdepth 1 -type f 2> /dev/null|wc -l)
| DIRS=$(find . -maxdepth 1 -type d 2> /dev/null|wc -l)
| DIRS=`expr $DIRS - 1`
| PS1=$( echo "%{\e[1;34m%}%n%{\e[0m%}%(#.@%{\e[1;34m%}%m/>%{\e[0m%}.:%{\e[1;34m%} \>%{\e[0m%}) ")
| RPS1=$(echo "%(?..%{\e[31m%}%B(%?) %b%{\e[0m%})%14<..<%/%}%<<%{\e[1;30m%} [$DIRS,$FILE]%{\e[0m%} ")
| }
`--------------------
Bye
Sartoo
--
Was kann an der Arbeit gut sein, wenn die Reichen sie den Armen überlassen?
-- Graffito
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Coolest prompt?
2004-06-11 10:29 Coolest prompt? Ziggy
` (4 preceding siblings ...)
2004-06-18 16:08 ` Sartoo
@ 2004-07-08 1:15 ` Geoff Wing
5 siblings, 0 replies; 9+ messages in thread
From: Geoff Wing @ 2004-07-08 1:15 UTC (permalink / raw)
To: zsh-users
Ziggy <myrmidon@vfemail.net> typed:
: ZSH allows the user to create interesting prompts. Time displaying, menu bars
: and colors.
: Post your prompt (and .zshrc) here.
No-one seems to use POSTEDIT for their setup so I thought I'd post mine to
give people some more ideas. Here's what I've been using for some years
which only uses normal and bold text. (Also note, generally the %s%u%m at
the start of the PROMPT is redundant so it could be ripped it out if you use
it).
PROMPT='%b%s%u%m:%B%3c%b%# %B'
RPROMPT="%b%?:${SHLVL}:%h:%l %B%D{%F %R}%b"
POSTEDIT=`print -P -n %b`
Regards,
Geoff
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2004-07-08 1:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-11 10:29 Coolest prompt? Ziggy
2004-06-11 12:07 ` Thomas Köhler
2004-06-11 21:20 ` Aaron Davies
2004-06-11 22:34 ` William Scott
2004-06-15 15:18 ` Julius Plenz
2004-06-17 12:25 ` Vincent Lefevre
2004-06-17 17:50 ` Sami Samhuri
2004-06-18 16:08 ` Sartoo
2004-07-08 1:15 ` Geoff Wing
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).