summaryrefslogtreecommitdiff
path: root/net:opera.openwide.fr/host:groumpf/Prompts.zsh
blob: 09cd690a34c2a7ad87c138a0b972d064f289c855 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
}