zshã®å³ããã³ããã«ã³ãã³ãéå§çµäºæå»ã表示
ã³ãã³ãã®éå§æå»ã¨çµäºæå»ãå³ããã³ããã«è¡¨ç¤ºããããªã£ãã
$ 15:00:00 - # 15æ00å00ç§ã« sleep 30 ãå ¥åéå§ $ sleep 30 15:00:00 - # 10ç§æã㦠sleep 30 ã¨æã¡è¾¼ãã $ sleep 30 15:00:00 - 15:00:10 # 15æ00å10ç§ã«ã¨ã³ã¿ã¼ãã¼æ¼ãã # 30ç§çµé $ 15:00:40 - # 15æ00å40ç§ã«ã³ãã³ãçµäº
ãããå®ç¾ããã«ã¯ã以ä¸ã®ã³ã¼ãã ~/.zshrc
ã«æ¸ãè¾¼ãã°å®ç¾ã§ãããã ãã¶è©¦è¡é¯èª¤ããã
export PREV_COMMAND_END_TIME export NEXT_COMMAND_BGN_TIME function show_command_end_time() { PREV_COMMAND_END_TIME=`date "+%H:%M:%S"` RPROMPT="${PREV_COMMAND_END_TIME} - " } autoload -Uz add-zsh-hook add-zsh-hook precmd show_command_end_time show_command_begin_time() { NEXT_COMMAND_BGN_TIME=`date "+%H:%M:%S"` RPROMPT="${PREV_COMMAND_END_TIME} - ${NEXT_COMMAND_BGN_TIME}" zle .accept-line zle .reset-prompt } zle -N accept-line show_command_begin_time
ã°ã°ã£ããä¼¼ããããªè¨å®ãã¦ã人ãå½å å¤ã«æ£è¦ãããã®ã ãã éå§æå»ã¨çµäºæå»ã®ä¸¡æ¹ãUPDATEãã¦ããä¾ãè¦ã¤ãããªãã£ãã ããã¨ä¾¿å©ã ã¨æãã使ãã¨ãããï½