Warning!

Notice: the grml team is migrating from Mercurial to Git.
Please visit git.grml.org instead!

/etc/zsh/zshrc: re-enable smiley, allow manual overriding of RPROMPT
authorMichael Prokop <mika@grml.org>
Sat Apr 21 23:58:54 2007 +0200 (19 months ago)
changeset 15312f7d5fa85d9
manifest12f7d5fa85d9
parent 15256ad3e4837b9
child 154ba5f42dfe386
/etc/zsh/zshrc: re-enable smiley, allow manual overriding of RPROMPT
debian/changelog
etc/zsh/zshrc
--- a/debian/changelog Sat Apr 21 23:38:22 2007 +0200
+++ b/debian/changelog Sat Apr 21 23:58:54 2007 +0200
@@ -1,3 +1,12 @@ grml-etc-core (0.2.47) unstable; urgency
+grml-etc-core (0.2.48) unstable; urgency=low
+
+ * /etc/zsh/zshrc:
+ - re-enable smiley in RPROMPT, thanks to transient_rprompt
+ [thanks for the pointer, Christian Schneider!]
+ - allow manual overriding of RPROMPT
+
+ -- Michael Prokop <mika@grml.org> Sat, 21 Apr 2007 23:57:28 +0200
+
grml-etc-core (0.2.47) unstable; urgency=low
* Big rewrite of /etc/zsh/completion.d/, thanks to ft!
--- a/etc/zsh/zshrc Sat Apr 21 23:38:22 2007 +0200
+++ b/etc/zsh/zshrc Sat Apr 21 23:58:54 2007 +0200
@@ -3,7 +3,7 @@
# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2.
-# Latest change: Son Apr 15 22:36:24 CEST 2007 [mika]
+# Latest change: Sam Apr 21 23:57:20 CEST 2007 [mika]
################################################################################
# This file is sourced only for interactive shells. It
# should contain commands to set up aliases, functions,
@@ -443,17 +443,20 @@ fi
# precmd () { setopt promptsubst; [[ -o interactive ]] && jobs -l;
+ setopt transient_rprompt # make sure to use right prompt only when not running a command
is4 && [[ -z $NOPRECMD ]] && precmd () {
[[ -n $NOPRECMD ]] && return 0
+ # allow manual overwriting of RPROMPT
+ [[ -n $RPROMPT ]] && echo -n $'\ekzsh\e\\' && return 0
# just use DONTSETRPROMPT=1 to be able to overwrite RPROMPT
- if [[ -z ${DONTSETRPROMPT} ]] ; then
- if [ -n "$BATTERY" ] ; then
- # RPROMPT="%(?..:()% ${PERCENT}${SCREENTITLE}"
- RPROMPT="${PERCENT}${SCREENTITLE}"
- else
- # RPROMPT="%(?..:()% ${SCREENTITLE}"
- RPROMPT="${SCREENTITLE}"
- fi
+ if [[ -z $DONTSETRPROMPT ]] ; then
+ if [[ -n $BATTERY ]] ; then
+ RPROMPT="%(?..:()% ${PERCENT}${SCREENTITLE}"
+ # RPROMPT="${PERCENT}${SCREENTITLE}"
+ else
+ RPROMPT="%(?..:()% ${SCREENTITLE}"
+ # RPROMPT="${SCREENTITLE}"
+ fi
fi
# adjust title of xterm
# see http://www.faqs.org/docs/Linux-mini/Xterm-Title.html
@@ -476,15 +479,15 @@ fi
# get the name of the program currently running and hostname of local machine
# set screen window title if running in a screen
if [[ "$TERM" == screen* ]]; then
- # local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} # dont't use hostname
- local CMD="${1[(wr)^(*=*|sudo|ssh|-*)]}$NAME" # use hostname
- echo -ne "\ek$CMD\e\\"
+ # local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} # dont't use hostname
+ local CMD="${1[(wr)^(*=*|sudo|ssh|-*)]}$NAME" # use hostname
+ echo -ne "\ek$CMD\e\\"
fi
# set the screen title to "zsh" when sitting at the command prompt:
if [[ "$TERM" == screen* ]]; then
- SCREENTITLE=$'%{\ekzsh\e\\%}'
+ SCREENTITLE=$'%{\ekzsh\e\\%}'
else
- SCREENTITLE=''
+ SCREENTITLE=''
fi
# adjust title of xterm
case $TERM in (xterm*|rxvt)
@@ -522,11 +525,11 @@ fi
# don't use colors on dumb terminals (like emacs):
if [[ "$TERM" == dumb ]] ; then
- PROMPT="${EXITCODE}${debian_chroot:+($debian_chroot)}%n@%m %40<...<%B%~%b%<< %# "
+ PROMPT="${EXITCODE}${debian_chroot:+($debian_chroot)}%n@%m %40<...<%B%~%b%<< %# "
else
# only if $GRMLPROMPT is set (e.g. via 'GRMLPROMPT=1 zsh') use the extended prompt
# set variable identifying the chroot you work in (used in the prompt below)
- if [[ -n "$GRMLPROMPT" ]]; then
+ if [[ -n $GRMLPROMPT ]]; then
PROMPT="${RED}${EXITCODE}${CYAN}[%j running job(s)] ${GREEN}{history#%!} ${RED}%(3L.+.) ${BLUE}%* %D
${BLUE}%n${NO_COLOUR}@%m %40<...<%B%~%b%<< %# "
else