diff options
| author | Caroline Larimore <caroline@larimo.re> | 2024-08-15 14:52:27 -0700 |
|---|---|---|
| committer | Caroline Larimore <caroline@larimo.re> | 2024-08-15 14:52:27 -0700 |
| commit | f1031596e28888486e97bfafb10e3e54886b3926 (patch) | |
| tree | 08a5a5412e13902805582cd74f9c6ded95ce1f6f /core | |
| parent | 3a5e9b0da0239d8ab0a338aed3b412438afb223e (diff) | |
core: add nix shell/subshell to bash prompt
Diffstat (limited to 'core')
| -rw-r--r-- | core/bash/prompt.sh | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/core/bash/prompt.sh b/core/bash/prompt.sh index 56bde5b..b43905d 100644 --- a/core/bash/prompt.sh +++ b/core/bash/prompt.sh @@ -5,10 +5,6 @@ if [[ "$TERM" == "xterm-kitty" ]]; then printf '\[\e[49m\e[38;5;237m\]◖\[\e[48;5;237m\e[39m\]%s\[\e[0m\e[49m\e[38;5;237m\]◗\[\e[0m\]' "$@"; } - function prompt.bubble_squared { - printf '\[\e[48;5;237m\e[39m\] %s\[\e[0m\e[49m\e[38;5;237m\]◗\[\e[0m\]' "$@"; - } - function prompt.git { GIT_PS1_STATESEPARATOR=';' GIT_PS1_SHOWDIRTYSTATE=1 @@ -36,10 +32,20 @@ if [[ "$TERM" == "xterm-kitty" ]]; then function prompt.prepare { local err=$? - PS1='\n' + + local subshell='' + if [[ -n "$IN_NIX_SHELL" ]]; then + subshell="\\[\e[33m\\]nix" + fi + if [[ $SHLVL != 1 && ! ($SHLVL == 2 && -n "$IN_NIX_SHELL") ]]; then + if [[ -n "$subshell" ]]; then subshell+="\\[\e[39m\\] "; fi + subshell+="\\[\e[2;37m\\]$SHLVL" + fi + if [[ -n "$subshell" ]]; then + PS1+="$(prompt.bubble "$subshell") " + fi - # change these to prompt.bubble_squared for squared user/hostname if [[ $EUID == 0 ]]; then PS1+="$(prompt.bubble "\\[\e[4m\\]\u@\H")" else |