diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2023-04-20 10:13:17 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2023-04-20 10:13:17 +0800 |
commit | a8a7eee0c27c6fc79652bf7abe09a712858c005d (patch) | |
tree | 42c7dc6f84b86cd045ec77f515f47ce31c5d52e2 /zsh/zshrc | |
parent | 685e981e8f01b2ce549345c521b038c9e6bb4715 (diff) |
Add number of jobs in prompt
Diffstat (limited to 'zsh/zshrc')
-rw-r--r-- | zsh/zshrc | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -48,9 +48,17 @@ function _get_context() { | |||
48 | } | 48 | } |
49 | 49 | ||
50 | autoload -Uz add-zsh-hook | 50 | autoload -Uz add-zsh-hook |
51 | autoload -Uz parameter | ||
51 | add-zsh-hook precmd precmd | 52 | add-zsh-hook precmd precmd |
52 | function precmd() { | 53 | function precmd() { |
53 | PROMPT='%B%(?:%F{green}%m%f:%K{red}%F{black}%m%f%k)%f%F{cyan} %c%f%b ' | 54 | jobstring="$#jobstates"; |
55 | if [ "$jobstring" = 0 ]; then | ||
56 | unset jobstring | ||
57 | else | ||
58 | jobstring="%K{white}%F{black}$jobstring%f%k " | ||
59 | fi | ||
60 | PROMPT="${jobstring}%B%(?:%F{green}%m%f:%K{red}%F{black}%m%f%k)%f%F{cyan} %c%f%b " | ||
61 | |||
54 | # Show context and git status of tracking repos at right | 62 | # Show context and git status of tracking repos at right |
55 | RIGHT=$(NUM=$($SETTING_DIR/bin/git/check-repos.sh -n); (( $NUM != 0 )) && echo $NUM) | 63 | RIGHT=$(NUM=$($SETTING_DIR/bin/git/check-repos.sh -n); (( $NUM != 0 )) && echo $NUM) |
56 | _get_context | 64 | _get_context |