tags:

views:

161

answers:

1

I know that I can exec a date command in my zsh prompt. However, it shows the old time; to see the current time, I have to hit and get a new prompt with the current time.

Is there a way to configure the zsh prompt to constantly update itself every second?

Thanks!

+6  A: 

This would be .... unpleasant in a standard zsh prompt (or bash, or other shells).

I suggest you'd be better off using Gnu Screen.

Screen can have a status line which can show the time. Here's an example screenrc scroll down to "Red Hat Magazine A guide to GNU Screen" to see the sample (i'll reproduce that here) which will, when screen is run, show the current time in the lower right corner of the terminal:

~/.screenrc

hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'

# Default screens
screen -t shell1        0
screen -t shell2        1

http://www.gnu.org/software/screen/

SuperMagic