aboutsummaryrefslogtreecommitdiff
path: root/zsh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-12-27 02:26:00 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-12-27 02:26:00 +1300
commit90dcadfb2e6e82b7d5e9bdbac2c109433f70caf7 (patch)
treec4d5ba26f25be189cf76fd6eef1103b9fe068b84 /zsh
parentc360f95111c23374490acbec30c22b85e1e3542b (diff)
downloaddotfiles-90dcadfb2e6e82b7d5e9bdbac2c109433f70caf7.tar.gz
Realised easy win avoiding subshells
And also the PROMPT_RETURN fudge in Bash/Zsh
Diffstat (limited to 'zsh')
-rw-r--r--zsh/zshrc.d/prompt.zsh13
1 files changed, 2 insertions, 11 deletions
diff --git a/zsh/zshrc.d/prompt.zsh b/zsh/zshrc.d/prompt.zsh
index 5dc00fd3..27db61cb 100644
--- a/zsh/zshrc.d/prompt.zsh
+++ b/zsh/zshrc.d/prompt.zsh
@@ -8,14 +8,6 @@ prompt() {
on)
setopt promptsubst promptpercent
- # Declare the PROMPT_RETURN variable as an integer
- declare -i PROMPT_RETURN
-
- # Set up pre-prompt command
- precmd() {
- PROMPT_RETURN=$?
- }
-
# Basic prompt shape depends on whether we're in SSH or not
PS1=
if [[ -n $SSH_CLIENT ]] || [[ -n $SSH_CONNECTION ]] ; then
@@ -24,7 +16,7 @@ prompt() {
PS1=$PS1'%~'
# Add sub-commands; VCS, job, and return status checks
- PS1=$PS1'$(prompt vcs)$(prompt job)$(prompt ret)'
+ PS1=$PS1'$(ret=$?;prompt vcs;prompt job;prompt ret)'
# Add prefix and suffix
PS1='${PROMPT_PREFIX}'$PS1'${PROMPT_SUFFIX}'
@@ -52,7 +44,6 @@ prompt() {
# Revert to simple inexpensive prompts
off)
- unset -v precmd PROMPT_RETURN
PS1='\$ '
PS2='> '
PS3='? '
@@ -187,7 +178,7 @@ prompt() {
# Show return status of previous command in angle brackets, if not zero
ret)
- ((PROMPT_RETURN)) && printf '<%u>' "$PROMPT_RETURN"
+ ((ret)) && printf '<%u>' "$ret"
;;
# Show the count of background jobs in curly brackets, if not zero