aboutsummaryrefslogtreecommitdiff
path: root/core/bash/prompt.sh
diff options
context:
space:
mode:
authorCaroline Larimore <caroline@larimo.re>2024-08-15 16:28:16 -0700
committerCaroline Larimore <caroline@larimo.re>2024-08-15 16:28:16 -0700
commit0ebf40c5a15461eed01e7e64bb0c563a4e695513 (patch)
treeee86af3a5834a72eb1598fb000a6c69b4d5afa98 /core/bash/prompt.sh
parent515c2306c611b6ad733f2a99a1dbd7d27cc36b24 (diff)
core: change prompt subshell detection
Diffstat (limited to 'core/bash/prompt.sh')
-rw-r--r--core/bash/prompt.sh10
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") "