dotfiles

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 19b91002141201225e285a50f81aceb027ec3136
parent 35cf7ae3bba059d39b311a16ff34b73cd021218a
Author: Janis Pagel <janis.pagel@ims.uni-stuttgart.de>
Date:   Sun, 10 Mar 2019 14:07:54 +0100

Display number of background processes in prompt

Diffstat:
Mzsh/zsh_functions | 8++++++++
Mzsh/zshrc | 2+-
2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/zsh/zsh_functions b/zsh/zsh_functions @@ -23,6 +23,14 @@ function get_stripped_dir_count() { unset RES } +# Function to parse the number of background processes +function bg_process() { + NUM_BG=$(jobs -l | wc -l) + if [ ! "$NUM_BG" -eq "0" ]; then + echo "[bg: $NUM_BG]" + fi +} + # Git parse_git_branch() { diff --git a/zsh/zshrc b/zsh/zshrc @@ -118,7 +118,7 @@ GIT_PROMPT_MODIFIED="%{$fg_bold[yellow]%}+%{$reset_color%}" # tracked files GIT_PROMPT_STAGED="%{$fg_bold[green]%}->%{$reset_color%}" # staged changes present = ready for "git push" # Right prompt with exit status of previous command if not successful -RPROMPT='$(git_prompt_string) %{$fg[red]%}%(?..[%?])%{$reset_color%} %{$fg[green]%}(%*)%{$reset_color%}' +RPROMPT='%{$fg[green]%}$(bg_process)%{$reset_color%} $(git_prompt_string) %{$fg[red]%}%(?..[%?])%{$reset_color%} %{$fg[green]%}(%*)%{$reset_color%}' ################# ##### Misc ######