Fix SHLVL in tmux

This commit is contained in:
Fernando Schauenburg 2019-02-25 23:38:12 +01:00
parent a13a965961
commit 8da84cdc64
2 changed files with 4 additions and 7 deletions

View file

@ -185,12 +185,7 @@ bashrc_customize_terminal_colors() {
bashrc_set_prompt() { bashrc_set_prompt() {
local exit_code=$? local exit_code=$?
local level=$SHLVL local level=$SHLVL
if [[ -n "$TMUX" ]]; then
level=$(($SHLVL - 2))
fi
local prompt=$(printf '\$%.0s' $(seq 1 $level)) local prompt=$(printf '\$%.0s' $(seq 1 $level))
local color="$cyan" local color="$cyan"
if [ $EUID -eq 0 ]; then if [ $EUID -eq 0 ]; then

View file

@ -44,8 +44,10 @@ set -g status-justify centre
set -g status-left '@#h ⧉ #S' # @host ⧉session set -g status-left '@#h ⧉ #S' # @host ⧉session
set -g status-right '%Y-%m-%d %a %H:%M' # date, weekday, time set -g status-right '%Y-%m-%d %a %H:%M' # date, weekday, time
# Make sure we always start at 1, even when invoked from a wrapper script # The shell will increment SHLVL by one when it is started -> unsetting this
set-environment -g SHLVL 1 # variable here removes any memory of nesting before tmux was executed and will
# cause shells to start with level 1 again within the session.
set-environment -gu SHLVL
# #
# Colors # Colors