mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-08-07 06:08:39 +02:00
agnoster: improve perf with use of $jobstates (zsh/parameter module)
This saves multiple fork/execs (for the subshell and wc) each time the prompt is rendered
This commit is contained in:
parent
e273cf004e
commit
015e6242aa
1 changed files with 2 additions and 1 deletions
|
|
@ -29,6 +29,7 @@
|
||||||
# A few utility functions to make it easy and re-usable to draw segmented prompts
|
# A few utility functions to make it easy and re-usable to draw segmented prompts
|
||||||
|
|
||||||
CURRENT_BG='NONE'
|
CURRENT_BG='NONE'
|
||||||
|
zmodload zsh/parameter
|
||||||
|
|
||||||
# Special Powerline characters
|
# Special Powerline characters
|
||||||
|
|
||||||
|
|
@ -207,7 +208,7 @@ prompt_status() {
|
||||||
symbols=()
|
symbols=()
|
||||||
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘"
|
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘"
|
||||||
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
|
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
|
||||||
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
|
[[ ${#jobstates} -ne 0 ]] && symbols+="%{%F{cyan}%}⚙"
|
||||||
|
|
||||||
[[ -n "$symbols" ]] && prompt_segment black default "$symbols"
|
[[ -n "$symbols" ]] && prompt_segment black default "$symbols"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue