aboutsummaryrefslogtreecommitdiff
path: root/zshrc.d
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2022-07-21 11:26:08 +0200
committerKarel Kočí <cynerd@email.cz>2022-07-21 11:26:08 +0200
commita72880521555bff5a15f55bdd08fca9f3c414e9f (patch)
treeea075f2be185910c493c7432d45567545683f4e7 /zshrc.d
parent507a257bd586bf29364893bb6f62865e1bffbae0 (diff)
downloadshellrc-a72880521555bff5a15f55bdd08fca9f3c414e9f.tar.gz
shellrc-a72880521555bff5a15f55bdd08fca9f3c414e9f.tar.bz2
shellrc-a72880521555bff5a15f55bdd08fca9f3c414e9f.zip
zshrc: color yellow if we are in nix shell
Diffstat (limited to 'zshrc.d')
-rw-r--r--zshrc.d/prompt8
1 files changed, 7 insertions, 1 deletions
diff --git a/zshrc.d/prompt b/zshrc.d/prompt
index 2f84536..33b81ef 100644
--- a/zshrc.d/prompt
+++ b/zshrc.d/prompt
@@ -3,7 +3,13 @@
# Disable default prompt
command -v prompt >/dev/null && prompt off
-[ $UID -eq 0 ] && NCOLOR="red" || NCOLOR="green"
+if [ "$UID" -eq 0 ]; then
+ NCOLOR="red"
+elif [ -n "$IN_NIX_SHELL" ]; then
+ NCOLOR="yellow"
+else
+ NCOLOR="green"
+fi
PROMPT="%(?..%{$fg_bold[yellow]%}EXIT: %?
)%{$fg_bold[$NCOLOR]%}%n@%m:%{$fg_bold[blue]%}%1~%{$fg_bold[$NCOLOR]%}%(!.#.$)%{$reset_color%} "
unset NCOLOR