diff options
| author | Caroline Larimore <caroline@larimo.re> | 2024-08-15 16:28:16 -0700 |
|---|---|---|
| committer | Caroline Larimore <caroline@larimo.re> | 2024-08-15 16:28:16 -0700 |
| commit | 0ebf40c5a15461eed01e7e64bb0c563a4e695513 (patch) | |
| tree | ee86af3a5834a72eb1598fb000a6c69b4d5afa98 /core | |
| parent | 515c2306c611b6ad733f2a99a1dbd7d27cc36b24 (diff) | |
core: change prompt subshell detection
Diffstat (limited to 'core')
| -rw-r--r-- | core/bash/prompt.sh | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/core/bash/prompt.sh b/core/bash/prompt.sh index bae2237..965afe2 100644 --- a/core/bash/prompt.sh +++ b/core/bash/prompt.sh @@ -45,14 +45,18 @@ function prompt.git { function prompt.prepare { local err=$? PS1='\n' - + local subshell='' + local base_shlvl=1 + if [[ "$TERM_PROGRAM" == 'vscode' ]]; then base_shlvl=2; fi + local shlvl=$((SHLVL-base_shlvl)) + if [[ -n "$IN_NIX_SHELL" ]]; then subshell="\\[\e[33m\\]nix" fi - if [[ $SHLVL != 1 && ! ($SHLVL == 2 && -n "$IN_NIX_SHELL") ]]; then + if [[ $shlvl != 0 && ! ($shlvl == 1 && -n "$IN_NIX_SHELL") ]]; then if [[ -n "$subshell" ]]; then subshell+="\\[\e[39m\\] "; fi - subshell+="\\[\e[2;37m\\]$SHLVL" + subshell+="\\[\e[2;37m\\]$shlvl" fi if [[ -n "$subshell" ]]; then PS1+="$(prompt.bubble "$subshell") " |