initial checkin
[zsh-lovers.git] / zsh_people / thomas_koehler / uhr.zsh
1 # a watch for the prompt
2 # I have a multiline prompt, so beware!
3 # you may need to adjust the parameters
4 trap CRON ALRM
5 TMOUT=1
6 CRON() {
7    STRING=$(date)
8    # to right adjust the date: How many columns does our terminal
9    # have? Reduce by the length of $STRING+5
10    COL=$[COLUMNS-5]
11    COL=$[COL-$#STRING]
12    # Store the current cursor position; jump up two lines; jump to
13    # columns $COL
14    echo -n "\e7\e[2;A\e[$COL;G"
15    echo -n ""
16    # echo the date
17    echo -n "\e[0;37;44m-- $STRING --\e[0m"
18    # restore cursor position
19    echo -n "\e8"
20 }
21