summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@openwide.fr>2009-07-31 09:57:05 +0200
committerHugues Hiegel <hugues.hiegel@openwide.fr>2009-07-31 09:57:05 +0200
commitb7465ec2b06b53c942f56c6450422fcdd423fdd7 (patch)
treed7be4fdb72eb83f7594ecb6059a85fd9142ad1be
parenteddf06b830b2ff5422515c9df76322e567f18f8e (diff)
[Prompts] groumpf@openwide displays a date/time instead of redisplaying prompt
-rw-r--r--net:opera.openwide.fr/host:groumpf/Prompts.zsh28
1 files changed, 28 insertions, 0 deletions
diff --git a/net:opera.openwide.fr/host:groumpf/Prompts.zsh b/net:opera.openwide.fr/host:groumpf/Prompts.zsh
new file mode 100644
index 0000000..09cd690
--- /dev/null
+++ b/net:opera.openwide.fr/host:groumpf/Prompts.zsh
@@ -0,0 +1,28 @@
+##
+## Part of configuration files for Zsh 4
+## by Hugues Hiegel <hugues@hiegel.fr>
+##
+## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
+##
+## You are encouraged to use, modify, and redistribute
+## these files with or without this notice.
+##
+
+preexec ()
+{
+ term_title "$(echo $1 | tr ' \n' ' ;' | sed 's/%/%%/g;s/\\/\\\\/g;s/;$//')"
+ print -Pn "$C_$prompt_colors[exec]$_C"
+
+ __START_CMD_DATE=$(date)
+ __START_CMD_ZSH_=$(date "+%s")
+}
+
+precmd()
+{
+ __START_CMD_ZSH_=${__START_CMD_ZSH_:-$(date "+%s")}
+ [ "$[ `date "+%s"` - $__START_CMD_ZSH_ ]" -gt 1 ] && echo "$__START_CMD_DATE"
+
+ update_prompt
+ redisplay_prompt
+}
+