Add the following snippet at the bottom of ~/.zshrc file.
Option 1 - Just time
RPROMPT='[%D{%L:%M:%S}] '$RPROMPT
Option 2 - Date and time
RPROMPT="[%D{%f/%m/%y} | %D{%L:%M:%S}]"
When you are done, run $ source ~/.zshrc
to see the effect. If it doesn't work, quit iTerm2 and open it again.
转自:How to add timestamp on right hand side of ZSH / iTerm2 terminal prompt?
标签:RPROMPT,Option,zshrc,iTerm2,添加,时间,time,ZSH From: https://www.cnblogs.com/hicolin/p/17478399.html