diff options
| author | srdusr <trevorgray@srdusr.com> | 2023-05-17 23:52:16 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2023-05-17 23:52:16 +0200 |
| commit | b5da74458b600d333568bf204302876a7048dad5 (patch) | |
| tree | 2557864e9268eac96db9dc773c375a8d7adb08fb | |
| parent | 95a6ff885105851d566d98f575ac96c7604189db (diff) | |
| download | dotfiles-b5da74458b600d333568bf204302876a7048dad5.tar.gz dotfiles-b5da74458b600d333568bf204302876a7048dad5.zip | |
Add job indicator to prompt
| -rw-r--r-- | .config/zsh/.zshrc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 15f7d29..27159da 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -69,9 +69,16 @@ git_branch_test_color() { echo "" fi } -#PROMPT='%9c$(git_branch_test_color)%F{none} %# ' -#echo "${gitstatuscolor} (${ref})" +# Job indicator +jobs_status_indicator() { + local jobs_count=$(jobs | wc -l) + if [[ "$jobs_count" -gt 0 ]]; then + echo "jobs: ${jobs_count}" + else + echo "" + fi +} autoload -Uz add-zsh-hook vcs_info zstyle ':vcs_info:*' stagedstr ' +%F{15}staged%f' @@ -97,7 +104,7 @@ fi #add-zsh-hook function my_precmd () { vcs_info - PS1="%{┌─[%F{145}%n%f] %F{39}%0~%f%} ${vcs_info_msg_0_} + PS1="%{┌─[%F{145}%n%f] %F{39}%0~%f%} ${vcs_info_msg_0_} $(jobs_status_indicator) %{%{$terminfo_down_sc$(insert-mode)$terminfo[rc]%}%{└─%{["%{$(tput setaf 226)%}""%{$(tput blink)%}"%{$%}"%{$(tput sgr0)%}"%{%G]%}%}%}%}" } @@ -107,7 +114,7 @@ function set-prompt () { (main|viins) VI_MODE="$(insert-mode)" ;; (*) VI_MODE="$(insert-mode)" ;; esac - PS1="%{┌─[%F{145}%n%f] %F{39}%0~%f%} ${vcs_info_msg_0_} + PS1="%{┌─[%F{145}%n%f] %F{39}%0~%f%} ${vcs_info_msg_0_} $(jobs_status_indicator) %{%{$terminfo_down_sc$VI_MODE$terminfo[rc]%}%{└─%{["%{$(tput setaf 226)%}""%{$(tput blink)%}"%{$%}"%{$(tput sgr0)%}"%{%G]%}%}%}%}" } add-zsh-hook precmd my_precmd |
