aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-12-18 23:35:41 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-12-18 23:35:41 +1300
commitbc8e7346a9f4d0d2c65b47c9642ef8a460ce71d8 (patch)
tree2521adf771e421463a23dd7ec7fa49edc03c0735 /sh
parentMerge branches 'freebsd' and 'openbsd' (diff)
downloaddotfiles-bc8e7346a9f4d0d2c65b47c9642ef8a460ce71d8.tar.gz
dotfiles-bc8e7346a9f4d0d2c65b47c9642ef8a460ce71d8.zip
Move TMUX_SHLVL trick into shrc.d
Diffstat (limited to 'sh')
-rw-r--r--sh/shrc.d/tmux.sh9
1 files changed, 9 insertions, 0 deletions
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