aboutsummaryrefslogtreecommitdiff
path: root/zsh/zshrc.d/prompt.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'zsh/zshrc.d/prompt.zsh')
-rw-r--r--zsh/zshrc.d/prompt.zsh30
1 files changed, 20 insertions, 10 deletions
diff --git a/zsh/zshrc.d/prompt.zsh b/zsh/zshrc.d/prompt.zsh
index 8fe9ffc7..317aba56 100644
--- a/zsh/zshrc.d/prompt.zsh
+++ b/zsh/zshrc.d/prompt.zsh
@@ -15,21 +15,17 @@ prompt() {
fi
PS1=$PS1'%~'
- # Add sub-commands; VCS, job, and return status checks
- PS1=$PS1'$(ret=$?;prompt vcs;prompt job;prompt ret)'
-
# Add a helpful prefix if this shell appears to be exotic
case ${SHELL##*/} in
(zsh) ;;
(*) PS1=zsh:$PS1 ;;
esac
- # If torsocks is on, report that
- case $LD_PRELOAD in
- (*/libtorsocks.so:|*/libtorsocks.so)
- PS1='[Tor]'$PS1
- ;;
- esac
+ # Add sub-commands:
+ ## Preload libraries as prefix
+ PS1='$(prompt preload)'$PS1
+ ## VCS, job, and return status checks as suffixes
+ PS1=$PS1'$(ret=$?;prompt vcs;prompt job;prompt ret)'
# Add prefix and suffix
PS1='${PROMPT_PREFIX}'$PS1'${PROMPT_SUFFIX}'
@@ -60,7 +56,21 @@ prompt() {
fi
;;
- # Git prompt function
+ # Analyze LD_PRELOAD to see if we should report anything loaded
+ preload)
+ printf '%s:' "$LD_PRELOAD" |
+ while read -d : -r ; do
+ case $REPLY in
+ (*/libip2unix.so)
+ printf '[IP2Unix]'
+ ;;
+ (*/libtorsocks.so)
+ printf '[Tor]'
+ ;;
+ esac
+ done
+ ;;
+
git)
# Wrap as compound command; we don't want to see output from any of