diff options
-rw-r--r-- | bash/bashrc | 7 | ||||
-rw-r--r-- | sh/shrc.d/tmux.sh | 9 |
2 files changed, 9 insertions, 7 deletions
diff --git a/bash/bashrc b/bash/bashrc index 57d4bcf6..088182ef 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -81,13 +81,6 @@ 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" diff --git a/sh/shrc.d/tmux.sh b/sh/shrc.d/tmux.sh index bd954be8..32780c9d 100644 --- a/sh/shrc.d/tmux.sh +++ b/sh/shrc.d/tmux.sh @@ -17,3 +17,12 @@ tmux() { # Execute with concluded arguments command tmux "$@" } + +# If we have a SHLVL set from one of the shells that does that (bash, ksh93, +# zsh), then set a SHLVL-derived value that takes tmux into account if we +# haven't already. This can be used to show the current SHLVL in the prompt for +# more advanced shells. +if [ -n "$SHLVL" ] && [ -n "$TMUX" ] && [ -z "$TMUX_SHLVL" ] ; then + TMUX_SHLVL=$((SHLVL - 1)) + export TMUX_SHLVL +fi |