mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-08 04:34:00 +02:00
Merge e1de25c19a into 291e96dcd0
This commit is contained in:
commit
5d086f4f26
1 changed files with 26 additions and 0 deletions
|
|
@ -25,6 +25,9 @@
|
||||||
# jobs are running in this shell will all be displayed automatically when
|
# jobs are running in this shell will all be displayed automatically when
|
||||||
# appropriate.
|
# appropriate.
|
||||||
|
|
||||||
|
# Comment this to disable right side features like "$pipestatus return codes"
|
||||||
|
ENABLE_RPROMPT=y
|
||||||
|
|
||||||
### Segment drawing
|
### Segment drawing
|
||||||
# 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
|
||||||
|
|
||||||
|
|
@ -198,6 +201,22 @@ prompt_virtualenv() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prompt_code_returns() {
|
||||||
|
local show_returns=''
|
||||||
|
for n in $pipestat ; do
|
||||||
|
[[ "0" != "$n" ]] && show_returns=y
|
||||||
|
done
|
||||||
|
if [ "$show_returns" ] ; then
|
||||||
|
for n in $pipestat ; do
|
||||||
|
if [[ "0" != "$n" ]] ; then
|
||||||
|
prompt_segment red white $n
|
||||||
|
else
|
||||||
|
prompt_segment black blue $n
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Status:
|
# Status:
|
||||||
# - was there an error
|
# - was there an error
|
||||||
# - am I root
|
# - am I root
|
||||||
|
|
@ -225,4 +244,11 @@ build_prompt() {
|
||||||
prompt_end
|
prompt_end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## Right side prompt
|
||||||
|
build_rprompt() {
|
||||||
|
pipestat=($pipestatus)
|
||||||
|
prompt_code_returns
|
||||||
|
}
|
||||||
|
|
||||||
|
[[ "$ENABLE_RPROMPT" == "y" ]] && RPROMPT='%{%f%b%k%}$(build_rprompt) '
|
||||||
PROMPT='%{%f%b%k%}$(build_prompt) '
|
PROMPT='%{%f%b%k%}$(build_prompt) '
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue