summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-03-01 13:03:30 +0100
committerDaniel Friesel <derf@derf.homelinux.org>2009-03-01 13:03:30 +0100
commitc90d56078268662b821437cbfe6e79875bac17da (patch)
treef84c095c093ed4fcb230aee68748b30a72c04d69 /etc
parent7967a46e74aef7cf89a5b630bdf0f3b31ca088d7 (diff)
Updated prompt generation, fixed some RPS1 problems
Diffstat (limited to 'etc')
-rwxr-xr-xetc/functions/dirinfo8
-rw-r--r--etc/prompt39
2 files changed, 32 insertions, 15 deletions
diff --git a/etc/functions/dirinfo b/etc/functions/dirinfo
index 5781580..689c20f 100755
--- a/etc/functions/dirinfo
+++ b/etc/functions/dirinfo
@@ -10,4 +10,10 @@ typeset string
[[ -d .svn ]] && string+='svn '
[[ -f Makefile || -f makefile ]] && string+='make '
-echo $string
+# if we're running in screen, we're the only one writing into the prompt
+# -> no trailing whitespace
+if [[ $TERM == screen ]] {
+ echo ${string% }
+} else {
+ echo $string
+}
diff --git a/etc/prompt b/etc/prompt
index 2cdfc8b..46f4b94 100644
--- a/etc/prompt
+++ b/etc/prompt
@@ -6,22 +6,33 @@
# psvar[1] = directory info
# psvar[2] = rtab (current directory)
-host="${ps_yellow}%m"
-dir="${ps_reset}%30<…<%2v%>>"
-(( EUID )) && ps_sign=$ps_green || ps_sign=$ps_red
-sign="%(!.#.>)"
-sign="${ps_sign}%(?.${sign}.%?)${ps_reset}"
-screen=$'%{\ek\e\\%}'
-
-PS1="${host} ${dir} ${sign} ${screen}"
-RPS1="${ps_yellow}[${ps_info}%1v${ps_yellow}"
-if [[ $TERM != screen ]] {
- RPS1+='%T'
+typeset -A ps rps
+
+ps=(
+ host "${ps_yellow}%m"
+ dir "${ps_reset}%30<…<%2v%>>"
+ sign "%(!.${ps_red}.${ps_green})%(?.%(!.#.>).%?)${ps_reset}"
+ screen $'%{\ek\e\\%}'
+)
+
+rps=(
+ start_always "${ps_yellow}["
+ start_screen "%(1V.${ps_yellow}["
+ dirinfo "${ps_info}%1v${ps_reset}"
+ time '%T'
+ end_always "${ps_yellow}]${ps_reset}"
+ end_screen "%(1V.${ps_yellow}]${ps_reset}.)"
+)
+
+PS1="${ps[host]} ${ps[dir]} ${ps[sign]} ${ps[screen]}"
+
+if [[ $TERM == screen ]] {
+ RPS1="${rps[start_screen]}${rps[dirinfo]}${rps[end_screen]}"
+} else {
+ RPS1="${rps[start_always]}${rps[dirinfo]}${rps[time]}${rps[end_always]}"
}
-RPS1+="]${ps_reset}"
-unset user at host
-unset dir ps_sign sign screen
+unset ps rps
zstyle ':prompt:rtab' fish yes
zstyle ':prompt:rtab' nameddirs yes