diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-11-30 10:48:14 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-11-30 10:48:14 +1300 |
commit | 8b4f5774b59398b964e9dce0866068f14744d631 (patch) | |
tree | bff19be02fc68063d9fb0c7f7eb22916d224c228 /bash/bashrc | |
parent | Only add > starting from SHLVL=2 (diff) | |
download | dotfiles-8b4f5774b59398b964e9dce0866068f14744d631.tar.gz dotfiles-8b4f5774b59398b964e9dce0866068f14744d631.zip |
Handle tmux sessions showing SHLVL properly
Diffstat (limited to 'bash/bashrc')
-rw-r--r-- | bash/bashrc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/bash/bashrc b/bash/bashrc index 088182ef..57d4bcf6 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -81,6 +81,13 @@ if ((BASH_VERSINFO[0] >= 4)) ; then ((BASH_VERSINFO[1] >= 3)) && shopt -s direxpand fi +# Set a SHLVL-derived value that takes tmux into account. This is used to show +# the current SHLVL in the prompt +if [[ -n $TMUX && -z $TMUX_SHLVL ]] ; then + TMUX_SHLVL=$((SHLVL - 1)) + export TMUX_SHLVL +fi + # Load Bash-specific startup files for sh in "$HOME"/.bashrc.d/*.bash ; do [[ -e $sh ]] && source "$sh" |