aboutsummaryrefslogtreecommitdiffhomepage
path: root/zsh/zshrc
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2023-04-20 10:13:17 +0800
committerHsieh Chin Fan <pham@topo.tw>2023-04-20 10:13:17 +0800
commita8a7eee0c27c6fc79652bf7abe09a712858c005d (patch)
tree42c7dc6f84b86cd045ec77f515f47ce31c5d52e2 /zsh/zshrc
parent685e981e8f01b2ce549345c521b038c9e6bb4715 (diff)
Add number of jobs in prompt
Diffstat (limited to 'zsh/zshrc')
-rw-r--r--zsh/zshrc10
1 files changed, 9 insertions, 1 deletions
diff --git a/zsh/zshrc b/zsh/zshrc
index 6a5a587..562ca20 100644
--- a/zsh/zshrc
+++ b/zsh/zshrc
@@ -48,9 +48,17 @@ function _get_context() {
48} 48}
49 49
50autoload -Uz add-zsh-hook 50autoload -Uz add-zsh-hook
51autoload -Uz parameter
51add-zsh-hook precmd precmd 52add-zsh-hook precmd precmd
52function precmd() { 53function 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