diff options
author | EuAndreh <eu@euandre.org> | 2022-05-13 14:36:32 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2022-05-13 14:36:32 -0300 |
commit | 936a17d2926f871c25cfd7bcfcc444064fdaf15e (patch) | |
tree | fa2d4d9c99d24efe9951f7c4c466fcd5dd6d02a5 /etc/bash | |
parent | etc/bash/check.sh: Add assert for FIXME markers (diff) | |
download | dotfiles-936a17d2926f871c25cfd7bcfcc444064fdaf15e.tar.gz dotfiles-936a17d2926f871c25cfd7bcfcc444064fdaf15e.tar.xz |
etc/bash/vcs-ps1.sh: Include `shell_level` in $PS1 variable
Diffstat (limited to 'etc/bash')
-rw-r--r-- | etc/bash/vcs-ps1.sh | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/etc/bash/vcs-ps1.sh b/etc/bash/vcs-ps1.sh index f2103da..4b440be 100644 --- a/etc/bash/vcs-ps1.sh +++ b/etc/bash/vcs-ps1.sh @@ -110,6 +110,19 @@ error_marker() { fi } +shell_level() { + if [ -n "${SHLVL:-}" ]; then + if [ -n "${TMUX:-}" ]; then + LVL=$((SHLVL - 1)) + else + LVL="$SHLVL" + fi + if [ "$LVL" != 1 ]; then + color -c white "[$LVL] " + fi + fi +} + timestamp() { color -c blacki '\T' } @@ -141,7 +154,7 @@ in_nix_shell() { fi } -PS1='`error_marker`'$(timestamp)' '$(path)' `repo_status``guix_env``in_nix_shell` +PS1='`error_marker`'$(timestamp)' '$(path)' `shell_level``repo_status``guix_env``in_nix_shell` $ ' |