Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [zsh] Re: psvar expansion with %v
- X-seq: zsh-users 9188
- From: Joel David Elkins <jde@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: [zsh] Re: psvar expansion with %v
- Date: Tue, 26 Jul 2005 11:28:59 -0500
- In-reply-to: <1050726140109.ZM29371@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20050723084210.GA7913@DervishD> <20050726073322.GA1945@DervishD> <1050726140109.ZM29371@xxxxxxxxxxxxxxxxxxxxxxx>
As Bart noted, you can't use %v as you want to, but you can get the
same effect using "set promptsubst" and PS1="\$psvar[1]". This was my
solution to a similar problem for my prompt. I attached it in hopes of
giving you more ideas, Raul.
Regards,
Joel
On Tue, Jul 26, 2005 at 02:01:09PM +0000, Bart Schaefer wrote:
> On Jul 26, 9:33am, DervishD wrote:
> }
> } > How can I use psvar and %v to get a readable PS1 *but* use escape
> } > sequences at the same time? I'm using zsh 4.2.5 (i686-pc-linux-gnu)
> }
> } I still haven't solved this, and I've carried a lot of tests. Is
> } any way of using '%{%}' constructs, or escape sequences, using psvar?
>
> No, there isn't. The results of percent-expandos are not re-expanded,
> so whatever gets inserted by %v appears literally in the final prompt.
> Furthermore, anything inserted by any percent-expando (be it your user
> name, or the host name, or the contents of psvar) is deliberately put
> through a conversion to printable form so that you can't accidentally
> mess up ZLE by moving the cursor or emitting something whose displayed
> length cannot be accurately counted.
>
> Consider the bad things that could otherwise result if you created a
> directory with strange characters in its name when your prompt has %/
> in it, or had such a directory in your path when using %N.
--
Joel Elkins <jde@xxxxxxxxx>
(alternate) <jdelkins@xxxxxxxxx>
# vim:ft=zsh fdm=marker
# $Id: prompt_jde_setup,v 1.15 2004/10/27 03:03:59 jde Exp $
# "jde" prompt theme -- a multiline theme of great tweaking
zmodload -i zsh/parameter || return 1
################################################################################
### HELP {{{
################################################################################
prompt_jde_help () {
setopt localoptions nocshnullcmd noshnullcmd
[[ $ZSH_VERSION < 3.1.6-dev-20 ]] &&
print 'Requires 3.1.6-dev-19 plus zsh-workers/10168.'$'\n'
<<-\EOF
This prompt provides a lot of information attractively. Observe:
user@host login tty new mail counts uptime loadavg 5,10,15 $PWD
v v v v v v v v v v
--| jde@zigzag : pts/468 : IN:3 m:22 p:58 |--| 25d03:13 : 0.10 0.07 0.01 |---| ~ |--
--| ?0 : !1004 : % |- -| 23:41 : 04-08-20 |--
^ ^ ^ ^
| history # time date
last exitcode
This prompt is tested on Linux and OpenBSD; on the latter, it
is required to have kernfs mounted on /kern for some features
to work properly, although there are simple (slower)
workarounds if you edit the script.
EOF
[[ $(read -Ek 1 "?${(%):-%S[press return]%s}") == [Qq] ]] &&
print -nP '\r%E' && return
<<-\EOF
The prompt is fully colorized, but as of now you have to edit the
script to change the colors. (I.e., it is not themable.)
Additionally, the scheme uses the alternate charset available with
vt100-type terminals (including nearly every xterm flavor) to draw
lines and angles. With some combinations of terminals and programs,
this may cause problems; the feature can be turned off with:
prompt jde -a
or
prompt jde noaltchar
In this case, standard ascii characters will be used instead. (The
example above is the ascii mode.)
You can re-enable line drawing with:
prompt jde altchar
EOF
[[ $(read -Ek 1 "?${(%):-%S[press return]%s}") == [Qq] ]] &&
print -nP '\r%E' && return
<<-\EOF
The mail count feature will read the mailboxes identified in the zsh
$PROMPT_JDE_MAILBOXES array parameter, which should have the form:
(TAG:/path/to/mailbox BOX2:/alt/box)
The script will read the mailboxes identified therein, and use the
"tag" as the key displayed next to the count of new mail. As of now, the
script only deals with maildir-style mailboxes. It will silently ignore
any non-maildir identified in $PROMPT_JDE_MAILBOXES, including directories
containing other mailboxes (which are supported by the zsh
implementation of mail checking).
When new mail arrives in any of the tracked mailboxes, the prompt will
change color briefly (one line).
If you do not want this feature, start the prompt with
prompt jde -m
or
prompt jde nomailcount
With this invocation, the prompt theme will work normally, but will omit
the mail count widget. To reenable this feature, use:
prompt jde mailcount
EOF
[[ $(read -Ek 1 "?${(%):-%S[press return]%s}") == [Qq] ]] &&
print -nP '\r%E' && return
<<-\EOF
When the screen is resized to the point where the "widgets" get
sqeezed, the script will attempt to shrink things appropriately.
First, the center widget on the first line (containing uptime and
load average info) will disappear. If yet more room is needed, the
$PWD element will be truncated on the left-hand side. The top
center (uptime) widget, if visible, will always try to remain
centered.
EOF
}
#############################################################################}}}
### UPTIME {{{
################################################################################
prompt_jde_uptime () {
setopt localoptions noksharrays
local -i upSeconds secs mins hours days
case "${OSTYPE:l}" in
linux*|cygwin*)
# optimization. -d. means delimiter is the decimal. Clever?
read -d. upSeconds </proc/uptime
;;
openbsd*)
# OpenBSD has /kern/boottime, which has as a drawback that
# it is the system time at boot, which is not (?) updated for
# subsequent system time changes.[1] It is therefore potentially
# inaccurate to do the following calculation, but who cares.
# Note using the print shell builtin to get the current
# system time in seconds since epoch. It's all about speed.
# [1] "man boottime" suggests differently, but there
# is a discrepancy between what uptime reports and
# this method, which I haven't figured out.
((upSeconds = $(print -P "%D{%s}") - $(</kern/boottime)))
# slower alternative would be to parse $(uptime)
;;
darwin*)
# Darwin has the same info as OpenBSD available as a
# sysctl parameter. In fact, this method would work as
# well (perhaps a tad slower) on OpenBSD, if the
# OpenBSD sysadmin prefers not to leave /kern mounted.
((upSeconds = $(print -P "%D{%s}") - $(sysctl -n kern.boottime)))
;;
esac
((secs = upSeconds % 60))
((mins = upSeconds / 60 % 60))
((hours = upSeconds / 3600 % 24))
((days = upSeconds / 86400))
if (( days > 0 )); then
echo -n "${days}d"
fi
printf '%.2d:%.2d' $hours $mins
}
#############################################################################}}}
### MAILCOUNTS {{{
################################################################################
# Count new mail in mailboxes. The resulting counts are put into assoc arrays
# PROMPT_JDE_MAILCOUNTS and PROMPT_JDE_MAILCOUNTS_OLD (holding former results.
# TODO: support mbox mailboxes.
# TODO: What do do with directory-of-mailboxes? Just ignore I guess.
# TODO: Is there some smarter way of determining the keys? It is very basic now.
prompt_jde_mailcounts () {
[[ $PROMPT_JDE_MAILCOUNT == no ]] && return
setopt localoptions nullglob
local -h line maildir files count key
typeset -gA PROMPT_JDE_MAILCOUNTS PROMPT_JDE_MAILCOUNTS_OLD
PROMPT_JDE_MAILCOUNTS_OLD=()
#${${(s::)${${(s:?:)x}[1]:t}}[1]}
for line in $PROMPT_JDE_MAILBOXES; do
maildir=${${(s.:.)line}[2]}
key=${${(s.:.)line}[1]}
[[ -d $maildir/new ]] || continue
files=($maildir/new/*)
count=${#files}
PROMPT_JDE_MAILCOUNTS_OLD[$key]=$PROMPT_JDE_MAILCOUNTS[$key]
PROMPT_JDE_MAILCOUNTS[$key]=$count
done
}
#############################################################################}}}
### LOADAVG {{{
################################################################################
prompt_jde_loadavg () {
setopt localoptions noksharrays
local -h loadavg
case "${OSTYPE:l}" in
linux*|cygwin*)
local -h one five fifteen rest
# read /proc/loadavg as a speedup over $(uptime|sed...)
read one five fifteen rest </proc/loadavg
loadavg="$one $five $fifteen"
;;
openbsd*)
# TODO: openbsd has /kern/loadavg, but what the hell do the #s mean?
loadavg=$(uptime | sed -e 's/.*load averages: \([.[:digit:]]*\), \([.[:digit:]]*\), \([.[:digit:]]\)/\1 \2 \3/')
;;
darwin*)
# Darwin leaves the commas out, ala BSD <= 4.1
loadavg=$(uptime | sed -e 's/.*load averages: \([.[:digit:]]*\) \([.[:digit:]]*\) \([.[:digit:]]\)/\1 \2 \3/')
;;
esac
print $loadavg
}
#############################################################################}}}
### TITLEBAR {{{
################################################################################
prompt_jde_titlebar() {
[[ -t 1 ]] || return
# commands like x='\n' cause \n to be expanded here because print
# by default interprets all of the ascii escape codes, which can
# screw up the titlebar... bad. So:
# 1. use print -R to output the actual string
# 2. make visible any unprintable characters using ${(V)1}
# TODO: other fail cases? I don't really care what the titlebar
# says, I just want to make damn sure it's safe.
local -h line=${(V)1}
case $TERM in
*xterm*|rxvt)
# don't want prompt expansion or escape codes on the
# "commandline" string, so split into several prints
print -Pn "\e]2;%(!.*ROOT*.%n)@%m:"
print -rn -- "${line}"
print -n "\a"
;;
screen)
# TODO: I don't use screen much, so I don't know if this works
print -Pn "\e]0;"
print -rn -- "${line}"
print -n "\a"
;;
esac
}
prompt_jde_preexec() {
# update the titlebar with the name of the command before executed...
# TODO: for example, vim; ^Z; fg will show the title bar as fg
prompt_jde_titlebar $1
}
#############################################################################}}}
### PRECMD {{{
################################################################################
# This func, precmd, does the grunt work of finding data to put into the prompt
# string (just the top line), with some formatting logic (mostly setting widths
# of horizontal fills). Even though there is a dependency on $COLUMNS, there are
# few assumptions made about the eventual display of the information calculated
# herein.
# 1. The general layout is assumed -- three sections with horizontal fills
# 2. The three sections should be prototyped, without formatting codes, in the
# variables psvar[1] (left), psvar[2] (middle), and psvar[3] (right). These
# must be set up before this function is called. (The are set by the ps1
# function below.)
# 3. $COLUMNS is read to calculate the size of the fill sections between the
# sections.
# The output of this function is stored in the $psvar array:
# $psvar[4]: the max allowable width of the center section (always either the
# full desired width or 1 character, depending on whether there is enough room
# or not, a binary outcome.)
# $psvar[5]: the max allowable width of the right section, which is the maximum
# possible space given that the left section is always shown in full.
# $psvar[6]: the width of the fill between the left and middle sections
# $psvar[7]: the width of the fill between the middle and right sections
# $psvar[8]: a string representing the system uptime
# $psvar[9]: a string representing the system load average
# $psvar[10]: the unformatted mail count string
# $psvar[11]: the formatted mail count string. By formatted, I mean that if a
# mailbox count changes from the prior invocation to this one, then special
# codes will bracket the appropriate string to so indicate. The tags are
# #ON# and #OFF#.
prompt_jde_precmd () {
setopt localoptions noxtrace noksharrays
# Mail counting
typeset -gA PROMPT_JDE_MAILCOUNTS # assoc holding (maildir count) pairs
typeset -gA PROMPT_JDE_MAILCOUNTS_OLD # the former setting (to asses new arrivals)
local -ha mail_unformatted mail_formatted # arrays holding strings for display
prompt_jde_mailcounts
local -h mckey="z"
for mckey in ${(k)PROMPT_JDE_MAILCOUNTS}; do
# mail_unformatted holds the key:count strings without
# formatting.
# mail_formatted has the same thing, but if new mail count has
# changed, then the strings are bracketed with #ON#...#OFF# tags
# to indicate to the gui layer that a highlight is warranted. (I
# keep gui code out of precmd.)
mail_unformatted+=("$mckey:$PROMPT_JDE_MAILCOUNTS[$mckey]")
if (( PROMPT_JDE_MAILCOUNTS[$mckey] != PROMPT_JDE_MAILCOUNTS_OLD[$mckey] )); then
mail_formatted+=("#ON#$mckey:$PROMPT_JDE_MAILCOUNTS[$mckey]#OFF#")
else
mail_formatted+=("$mckey:$PROMPT_JDE_MAILCOUNTS[$mckey]")
fi
done
# The following are dynamic. Need to set them first, as they are
# embedded in the $psvar[1..3] variables, for which we need to calculate
# widths here in a sec...
psvar[8]=$(prompt_jde_uptime)
psvar[9]=$(prompt_jde_loadavg)
psvar[10]=${(j: :)mail_unformatted}
psvar[11]=${(j: :)mail_formatted}
# now, the hard work of calculating the fill widths
local -i width1=${#${(%)psvar[1]}}
local -i width2=${#${(%)psvar[2]}}
local -i width3=${#${(%)psvar[3]}}
local -i fillsize_l fillsize_r
# 1. Calculate the width of the left fill assuming all widgets have full width
# 2. If not enough room, then disappear the middle widget
# 3. Calculate the right fill width in light of steps 1 & 2, but assuming the
# right fill (pwd) is at full width
# 4. If not enough room for this fill, then give it as much room as possible
# 5. Recalculate both fills one last time.
# the 3 constant allows room for the left and right corners, plus one blank
# on the right. This last is needed because RPROMPT leaves one blank to the
# right...
((fillsize_l = (COLUMNS - 3 - width1 - width2 - width3) / 2))
if (( fillsize_l < 0 )); then
width2=1
((fillsize_l = (COLUMNS - 3 - width1 - width2 - width3) / 2))
fi
((fillsize_r = COLUMNS - 3 - width1 - width2 - width3 - fillsize_l))
if ((fillsize_r < 0)); then
((width3 = width3 + (fillsize_r * 2) ))
fi
((fillsize_l = (COLUMNS - 3 - width1 - width2 - width3) / 2))
((fillsize_r = COLUMNS - 3 - width1 - width2 - width3 - fillsize_l))
psvar[4]=$width2
psvar[5]=$width3
psvar[6]=$fillsize_l
psvar[7]=$fillsize_r
# Update the titlebar before prompt display. Cooler this way than putting the
# control codes in PS1, I think.
prompt_jde_titlebar $(print -P "%~")
}
#############################################################################}}}
### PS1 {{{
################################################################################
# This function contains what I call "GUI" code -- it defines the layout and
# colors of the prompt. The heart of the script is here, although there is a
# fairly tight (yet clean) link with precmd. This func is not called every time
# a new line is entered; that's precmd's job. Rather, it sets up the prompt
# variables PS1 and PS2 so that the prompt will update itself using parameter
# expansion and prompt expansion. To understand the intricacies of this
# function, it will be necessary to follow the zsh manual zshmisc (prompt
# expansion) and zshexpn (parameter expansion).
prompt_jde_ps1 () {
setopt localoptions noxtrace noksharrays promptsubst
local -Ah altchar # assoc holding alternate character codes
set -A altchar ${(s..)terminfo[acsc]}
local -h pr_set_charset pr_shift_in pr_shift_out pr_dot pr_hbar \
pr_vbar pr_lvbar pr_rvbar pr_lrvbar pr_ulcorner pr_llcorner \
pr_lrcorner pr_urcorner
if [[ "$PROMPT_JDE_ALTCHAR" == no ]]; then
pr_set_charset=""
pr_shift_in=""
pr_shift_out=""
pr_dot=":"
pr_hbar="-"
pr_vbar="|"
pr_lvbar="|"
pr_rvbar="|"
pr_lrvbar="|"
pr_ulcorner="-"
pr_llcorner="-"
pr_lrcorner="-"
pr_urcorner="-"
else
pr_set_charset="%{$terminfo[enacs]%}"
pr_shift_in="%{$terminfo[smacs]%}"
pr_shift_out="%{$terminfo[rmacs]%}"
pr_dot=${altchar[~]:-:}
pr_hbar=${altchar[q]:--}
pr_vbar=${altchar[x]:-|}
pr_lvbar=${altchar[u]:-|}
pr_rvbar=${altchar[t]:-|}
pr_lrvbar=${altchar[n]:-|}
pr_ulcorner=${altchar[l]:--}
pr_llcorner=${altchar[m]:--}
pr_lrcorner=${altchar[j]:--}
pr_urcorner=${altchar[k]:--}
fi
#########################
# CONFIGURE COLORS HERE #
#########################
local -h rs="%{$reset_color%}"
local -h bkg="%{$bg[black]%}"
local -h normtext="%{$bg[black]$fg_bold[green]%}"
local -h hitext="%{$bg[black]$fg_no_bold[white]%}"
local -h invtext="%{$bg[black]$fg_bold[cyan]%}"
local -h alerttext="%{$bg[red]$fg_bold[yellow]%}"
local -h figuretext="%{$bg[black]$fg_bold[yellow]%}"
local -h linetext="%{$bg[black]$fg_no_bold[yellow]%}"
#########################
# END COLOR CONFIG #
#########################
local -h sep="${figuretext}${pr_shift_in}${pr_dot}${pr_shift_out}"
local -h user="%(#.$alerttext.$normtext)%(!.%U.)%n%(!.%u$bkg.)"
local -h at="${normtext}@"
local -h host="${hitext}%m"
local -h tty="${normtext}%l"
local -h mailcnt
if [[ $PROMPT_JDE_MAILCOUNT == yes ]]; then
mailcnt="$sep ${normtext}\${\${psvar[11]//\\#ON\\#/\"$alerttext\"}//\\#OFF\\#/\"$normtext\"} "
else
mailcnt=""
fi
local -h uptime="${normtext}%8v"
local -h loadavg="${normtext}%9v"
local -h date="${normtext}%D"
local -h time="${normtext}%T"
local -h grbeg="${figuretext}${pr_hbar}${pr_lvbar}"
local -h grend="${figuretext}${pr_rvbar}${pr_hbar}"
local -h exitcode="${normtext}?%(?.${invtext}.${alerttext})%?$bkg"
local -h histnr="${normtext}!${invtext}%!"
local -h pr="${normtext}%#"
local -h wd="${normtext}%U%~%u${normtext}"
# the following hold non-colorized versions of the first line prompt elements
# for use by precmd in determining string widths. NOTE: precmd expects
# these to be set!
if [[ $PROMPT_JDE_MAILCOUNT == yes ]];then
psvar[1]="-[ %n@%m : %l : %10v ]-" # left widget
else
psvar[1]="-[ %n@%m : %l ]-" # left widget
fi
psvar[2]="-[ %8v : %9v ]-" # middle widget
psvar[3]="-[ %~ ]-" # right widget
local -ah ps1 ps2 rps1
ps1=("$pr_set_charset$pr_shift_in"
"$figuretext$pr_ulcorner"
# The first widget is very simple
"$grbeg$pr_shift_out $user$at$host $sep $tty $mailcnt$pr_shift_in$grend"
# Next comes the first fill. $psvar[6] contains the width of the fill...
# use ${(l.$psvar[6]..$pr_hbar.)} to create the fill string
# Note, whenever we use parameter interpolation, we have to backwhack the \$
"$linetext\${(l.\${psvar[6]}..${pr_hbar}.)}" # fill left
# The following two lines implement the middle widget. Some notes:
# 1. The uptime text is in $psvar[8], and the loadavg text is in $psvar[9]
# 2. $psvar[4] will equal either 1 (if not enough room) or the required
# length for the middle widget
# 3. We truncate (using %<< construct) the widget to $psvar[4]
# 4. %%8v<blah< doesn't work! (And even %[%8vblah] doesn't!) So we have to
# resort to parameter interpolation... ah well.
# 5. The truncation string is $pr_hbar, meaning if there isn't room, then
# we draw a single - instead
# 6. The widget itself is pretty normal, except we replace the "d" in the
# uptime string with a different color using ${x/y/z}. Why do I torture
# myself?
# a. Tricky bit #1: the replacement string includes control codes and
# therefore } characters! So we have to quote it with \"
# b. Tricky bit #2: $ interpolation is done BEFORE % interpolation in
# prompts, therefore we cant use %8v, we have to use \$psvar[8]
"%\$psvar[4]<$pr_hbar<"
"$grbeg$pr_shift_out $normtext\${psvar[8]/d/\"${hitext}d${normtext}\"} $sep $normtext%9v $pr_shift_in$grend"
"%<<" # end the truncation
# Next comes the second fill. $psvar[7] contains its width...
"$linetext\${(l.\${psvar[7]}..${pr_hbar}.)}" # fill right
"$grbeg"
"$pr_shift_out"
# The $PWD widget (but only the part inside the groupings) is truncated
# to the length dictated by $psvar[5] (note $psvar[5] width is reduced by 6
# to allow for the group ends, which are always visible)
" %\$[psvar[5] - 6]<...<$wd%<< "
"$pr_shift_in"
"$grend"
"$figuretext$pr_urcorner"
"$pr_shift_out"
"$rs"
"$prompt_newline"
# Second line. Nothing very interesting here
"$pr_shift_in"
"$figuretext$pr_llcorner"
"$grbeg"
"$pr_shift_out"
" $exitcode $sep $histnr $sep $pr "
"$pr_shift_in"
"$grend"
"$pr_shift_out"
"$rs"
$' ' )
PS1="${(j::)ps1}"
rps1=("$pr_set_charset$pr_shift_in"
"$grbeg"
"$pr_shift_out"
" $time $sep $date "
"$pr_shift_in"
"$grend"
"$figuretext$pr_lrcorner"
"$pr_shift_out"
"$rs" )
RPS1="${(j::)rps1}"
# The following string, when interpolated at runtime (note,
# not here, of course) with PARAMETER expansion
# (note, not prompt expansion), should produce a string of
# exactly the same width as line 2 of PS1, the part between
# the $grbeg and $grend -- i.e., the content.
# It must also avoid containing right curlies '}' after
# interpolation. Finally, it should avoid any control
# codes since those may be counted with ${#} (which is how
# it's used in PS2) which we don't want.
local -h ps1line2=' ?${(%):-%?} : !${(%):-%!} : # '
ps2=("$pr_set_charset$pr_shift_in"
"$bkg $grbeg"
"$pr_shift_out"
# The following allows us to align the ps2 right side
# with the ps1 right side -- a cool visual effect.
#
# The downside is if %_ (which contains "for dquote..."
# type information -- the parser stack) can get
# truncated. To overcome this limitation, we show only
# the rightmost element of %_, along with the parser
# stack depth. More below...
#
# First, to align things, the strategy is to set up a
# right side truncation (%> >) with the length equal to
# the 2nd line of PS1 (the part between $grbeg and
# $grend). Then we pad the string with plenty of spaces.
"%\${#:-$ps1line2}> >"
# The following prints the number of words in %_
"$invtext \${(w)#\${(%):-%_}}"
# The following prints the last word of %_
#"$normtext \${\${(%):-%_}[(w)-1]}"
"$normtext %1_" # DUH!!
# Here is the big space pad needed to ensure we get to
# the right side of PS1's 2nd line. Should I be more
# precise, e.g. using ${(l...)}? Nah.
" "
"%<<" # end the truncation
"$pr_shift_in"
"$grend"
"$pr_shift_out"
"$rs"
$' ' )
PS2="${(j::)ps2}"
}
#############################################################################}}}
### WINCH {{{
################################################################################
#TODO: this is not getting called
prompt_jde_winch () {
setopt localoptions noksharrays
# Delete ourself from TRAPWINCH if not using our precmd insert.
[[ $functions[precmd] = *prompt_jde_precmd* ]] && prompt_jde_ps1 ||
functions[TRAPWINCH]="${functions[TRAPWINCH]//prompt_jde_winch}"
}
#############################################################################}}}
### SETUP {{{
################################################################################
prompt_jde_setup () {
# zsh options we require: prompt_*
prompt_opts=( cr subst percent )
setopt localoptions noksharrays
typeset -g PROMPT_JDE_ALTCHAR PROMPT_JDE_MAILCOUNT
: ${PROMPT_JDE_ALTCHAR:=yes}
: ${PROMPT_JDE_MAILCOUNT:=yes}
# A few extra niceties ...
repeat 1 case "$1:l" in
(off|disable)
functions[precmd]="${functions[precmd]//prompt_jde_precmd}"
functions[preexec]="${functions[preexec]//prompt_jde_preexec}"
functions[TRAPWINCH]="${functions[TRAPWINCH]//prompt_jde_winch}"
[[ $prompt_theme[1] = jde ]] && PS1=${${(f)PS1}[-1]}
return 1
;;
(on|enable)
shift
[[ $prompt_theme[1] = jde ]] && break
;&
(-a|noaltchar)
PROMPT_JDE_ALTCHAR=no
;;
(altchar)
PROMPT_JDE_ALTCHAR=yes
;;
(-m|nomailcount)
PROMPT_JDE_MAILCOUNT=no
;;
(mailcount)
PROMPT_JDE_MAILCOUNT=yes
;;
(*)
# nothing
;;
esac
[[ -z $PROMPT_JDE_MAILBOXES ]] && PROMPT_JDE_MAILCOUNT=no
prompt_jde_ps1
# Paste our special commands into precmd and TRAPWINCH
functions[precmd]="${functions[precmd]//prompt_*_precmd}
prompt_jde_precmd"
functions[preexec]="${functions[preexec]//prompt_*_preexec \"\$1\"}
prompt_jde_preexec \"\$1\""
functions[TRAPWINCH]="${functions[TRAPWINCH]//prompt_jde_winch}
prompt_jde_winch"
return 0
}
# }}}
[[ -o kshautoload ]] || prompt_jde_setup "$@"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author