aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--X/xinitrc.d/shlvl.sh2
-rw-r--r--bash/bashrc.d/prompt.bash5
-rw-r--r--ksh/kshrc.d/prompt.ksh11
-rw-r--r--sh/shrc.d/tmux.sh9
-rw-r--r--tmux/tmux.conf.m43
-rw-r--r--zsh/zshrc.d/prompt.zsh5
6 files changed, 13 insertions, 22 deletions
diff --git a/X/xinitrc.d/shlvl.sh b/X/xinitrc.d/shlvl.sh
new file mode 100644
index 00000000..0e3bad04
--- /dev/null
+++ b/X/xinitrc.d/shlvl.sh
@@ -0,0 +1,2 @@
+# Reset SHLVL
+unset SHLVL
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash
index 7058f4c3..ed09afdd 100644
--- a/bash/bashrc.d/prompt.bash
+++ b/bash/bashrc.d/prompt.bash
@@ -31,10 +31,9 @@ prompt() {
# Add terminating "$" or "#" sign
PS1=$PS1'\$'
- # Add > signs at the front of the prompt to show the current shell
- # level, taking tmux sessions into account
+ # Add > symbols to show nested shells
local shlvl
- for ((shlvl = SHLVL - TMUX_SHLVL; shlvl > 1; shlvl--)) ; do
+ for ((shlvl = 1; shlvl < SHLVL; shlvl++)) ; do
PS1='>'$PS1
done
diff --git a/ksh/kshrc.d/prompt.ksh b/ksh/kshrc.d/prompt.ksh
index 32bb8192..719b119f 100644
--- a/ksh/kshrc.d/prompt.ksh
+++ b/ksh/kshrc.d/prompt.ksh
@@ -35,15 +35,12 @@ function prompt {
# Add terminating "$" or "#" sign
PS1=$PS1'\$'
- # Add > signs at the front of the prompt to show the current shell
- # level, taking tmux sessions into account, assuming this version
- # of ksh does SHLVL; I think only ksh93t+ does it from what I can
- # tell
+ # Add > symbols to show nested shells
typeset shlvl
- ((shlvl = SHLVL - TMUX_SHLVL))
- while ((shlvl > 1)); do
+ shlvl=1
+ while ((shlvl < SHLVL)); do
PS1='>'$PS1
- ((shlvl--))
+ ((shlvl++))
done
# Declare variables to contain terminal control strings
diff --git a/sh/shrc.d/tmux.sh b/sh/shrc.d/tmux.sh
index 32780c9d..bd954be8 100644
--- a/sh/shrc.d/tmux.sh
+++ b/sh/shrc.d/tmux.sh
@@ -17,12 +17,3 @@ 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
diff --git a/tmux/tmux.conf.m4 b/tmux/tmux.conf.m4
index a4af9f8e..f9f62456 100644
--- a/tmux/tmux.conf.m4
+++ b/tmux/tmux.conf.m4
@@ -8,6 +8,9 @@ set-environment -gru SSH_CONNECTION
set-environment -gru SSH_TTY
set-environment -gru WINDOWID
+# Reset SHLVL
+set-environment -gru SHLVL
+
# Otherwise, use the environment we had when we started; don't touch it during
# a session unless I specifically ask
set-option -g update-environment ''
diff --git a/zsh/zshrc.d/prompt.zsh b/zsh/zshrc.d/prompt.zsh
index 4b98c125..5dc00fd3 100644
--- a/zsh/zshrc.d/prompt.zsh
+++ b/zsh/zshrc.d/prompt.zsh
@@ -32,10 +32,9 @@ prompt() {
# Add terminating "$" or "#" sign
PS1=$PS1'%#'
- # Add > signs at the front of the prompt to show the current shell
- # level, taking tmux sessions into account
+ # Add > symbols to show nested shells
local shlvl
- for ((shlvl = SHLVL - TMUX_SHLVL; shlvl > 1; shlvl--)) ; do
+ for ((shlvl = 1; shlvl < SHLVL; shlvl++)) ; do
PS1='>'$PS1
done