From 0ebf40c5a15461eed01e7e64bb0c563a4e695513 Mon Sep 17 00:00:00 2001 From: Caroline Larimore Date: Thu, 15 Aug 2024 16:28:16 -0700 Subject: core: change prompt subshell detection --- core/bash/prompt.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'core/bash') 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") " -- cgit v1.2.3