diff options
| -rw-r--r-- | zsh/zshrc | 10 |
1 files changed, 7 insertions, 3 deletions
| @@ -47,9 +47,13 @@ function _get_context() { | |||
| 47 | fi | 47 | fi |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | function _need_sync_after_wakeup() { | 50 | function _already_sync_after_wakeup() { |
| 51 | latest=$(date -d @`stat -c %Y ~/.wakeup` +%s) | 51 | latest=$(date -d @`stat -c %Y ~/.wakeup` +%s) |
| 52 | test "$latest" -ge "$(cat ~/.wakeup)" | 52 | if [ $latest -ge $(cat ~/.wakeup) ]; then |
| 53 | return 0 | ||
| 54 | else | ||
| 55 | return 1 | ||
| 56 | fi | ||
| 53 | } | 57 | } |
| 54 | 58 | ||
| 55 | autoload -Uz add-zsh-hook | 59 | autoload -Uz add-zsh-hook |
| @@ -71,7 +75,7 @@ function precmd() { | |||
| 71 | # Show context and git status of tracking repos at right | 75 | # Show context and git status of tracking repos at right |
| 72 | UNSYNC_REPOS=$(NUM=$($SETTING_DIR/bin/git/check-repos.sh -n); (( $NUM != 0 )) && echo $NUM) | 76 | UNSYNC_REPOS=$(NUM=$($SETTING_DIR/bin/git/check-repos.sh -n); (( $NUM != 0 )) && echo $NUM) |
| 73 | _get_context | 77 | _get_context |
| 74 | NEED_SYNC=$(_need_sync_after_wakeup || echo S) | 78 | NEED_SYNC=$(_already_sync_after_wakeup || echo S) |
| 75 | RPROMPT="%B%K{blue}%F{yellow}${CONTEXT:+ $CONTEXT }%f%k%K{red}%F{black}${UNSYNC_REPOS}${NEED_SYNC}%f%k%b" | 79 | RPROMPT="%B%K{blue}%F{yellow}${CONTEXT:+ $CONTEXT }%f%k%K{red}%F{black}${UNSYNC_REPOS}${NEED_SYNC}%f%k%b" |
| 76 | 80 | ||
| 77 | 81 | ||