aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-01-24 17:25:24 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-01-24 17:25:24 +1300
commita9c7669e1d9e1e16bde23a0f51ccd1c573d037de (patch)
tree0e61b06b6af21af9f89bdd761e69ebd183fff3f4
parent5981cb248e399b5594f9227b7de8f1c2b31e2c3f (diff)
downloaddotfiles-a9c7669e1d9e1e16bde23a0f51ccd1c573d037de.tar.gz
dotfiles-a9c7669e1d9e1e16bde23a0f51ccd1c573d037de.zip
Remove SHLVL nested shell feature for now
Causes a bit too much curliness in configuration; may need a more comprehensive approach.
-rw-r--r--README.markdown16
-rw-r--r--X/xinitrc.d/shlvl.sh2
-rw-r--r--X/xinitrc.d/xbindkeys.sh2
-rw-r--r--bash/bashrc.d/prompt.bash6
-rw-r--r--ksh/kshrc.d/prompt.ksh8
-rw-r--r--tmux/tmux.conf.m46
-rw-r--r--zsh/zshrc.d/prompt.zsh6
7 files changed, 8 insertions, 38 deletions
diff --git a/README.markdown b/README.markdown
index 3ee71195..0057415f 100644
--- a/README.markdown
+++ b/README.markdown
@@ -122,20 +122,17 @@ after testing `BASH_VERSINFO` appropriately.
A terminal session with my prompt looks something like this:
~$ ssh remote
- tom@remote:~$ bash
- >tom@remote:~$ cd .dotfiles
- >tom@remote:~/.dotfiles(master+!)$ git status
+ tom@remote:~$ cd .dotfiles
+ tom@remote:~/.dotfiles(master+!)$ git status
M README.markdown
M bash/bashrc.d/prompt.bash
A init
- >tom@remote:~/.dotfiles(master+!)$ foobar
+ tom@remote:~/.dotfiles(master+!)$ foobar
foobar: command not found
- >tom@remote:~/.dotfiles(master+!)<127>$ sleep 5 &
+ tom@remote:~/.dotfiles(master+!)<127>$ sleep 5 &
[1] 28937
- >tom@remote:~/.dotfiles(master+!){1}$
+ tom@remote:~/.dotfiles(master+!){1}$
-If `SHLVL` is greater than one, right angle brackets are added to show how many
-`bash` instances deep into the process tree we are, taking into account `tmux`.
The username and hostname are elided if not connected via SSH. The working
directory is always shown. The rest of the prompt expands based on context to
include these elements in this order:
@@ -148,8 +145,7 @@ include these elements in this order:
* The exit status of the last command, if non-zero
You can set `PROMPT_COLOR`, `PROMPT_PREFIX`, and `PROMPT_SUFFIX` too, which all
-do about what you'd expect. `PROMPT_PREFIX` will appear after the `SHLVL` angle
-brackets.
+do about what you'd expect.
This is all managed within the `prompt` function. There's some mildly hacky
logic on `tput` codes included such that it should work correctly for most
diff --git a/X/xinitrc.d/shlvl.sh b/X/xinitrc.d/shlvl.sh
deleted file mode 100644
index 0e3bad04..00000000
--- a/X/xinitrc.d/shlvl.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-# Reset SHLVL
-unset SHLVL
diff --git a/X/xinitrc.d/xbindkeys.sh b/X/xinitrc.d/xbindkeys.sh
index b50f5c60..b76aebdd 100644
--- a/X/xinitrc.d/xbindkeys.sh
+++ b/X/xinitrc.d/xbindkeys.sh
@@ -1,3 +1,3 @@
# Start xbindkeys(1)
command -v xbindkeys >/dev/null 2>&1 || return
-(cd -- "$HOME" && SHLVL= xbindkeys -n) &
+(cd -- "$HOME" && xbindkeys -n) &
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash
index 123c4146..c954ef97 100644
--- a/bash/bashrc.d/prompt.bash
+++ b/bash/bashrc.d/prompt.bash
@@ -28,12 +28,6 @@ prompt() {
# Add terminating "$" or "#" sign
PS1=$PS1'\$'
- # Add > symbols to show nested shells
- local shlvl
- for ((shlvl = 1; shlvl < SHLVL; shlvl++)) ; do
- PS1='>'$PS1
- done
-
# Declare variables to contain terminal control strings
local format reset
diff --git a/ksh/kshrc.d/prompt.ksh b/ksh/kshrc.d/prompt.ksh
index 84129efc..925db0cf 100644
--- a/ksh/kshrc.d/prompt.ksh
+++ b/ksh/kshrc.d/prompt.ksh
@@ -28,14 +28,6 @@ function prompt {
# Add terminating "$" or "#" sign
PS1=$PS1'\$'
- # Add > symbols to show nested shells
- typeset shlvl
- shlvl=1
- while ((shlvl < SHLVL)); do
- PS1='>'$PS1
- ((shlvl++))
- done
-
# Declare variables to contain terminal control strings
typeset format reset
diff --git a/tmux/tmux.conf.m4 b/tmux/tmux.conf.m4
index 9f1aa80f..a4af9f8e 100644
--- a/tmux/tmux.conf.m4
+++ b/tmux/tmux.conf.m4
@@ -8,16 +8,12 @@ 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 ''
# Setting this makes each new pane a non-login shell, which suits me better
-# Clear away SHLVL again first to stop it getting incremented twice
-set-option -g default-command "unset SHLVL ; exec $SHELL"
+set-option -g default-command "$SHELL"
# Expect a 256-color terminal
set-option -g default-terminal 'screen-256color'
diff --git a/zsh/zshrc.d/prompt.zsh b/zsh/zshrc.d/prompt.zsh
index 898031ea..a22739d3 100644
--- a/zsh/zshrc.d/prompt.zsh
+++ b/zsh/zshrc.d/prompt.zsh
@@ -24,12 +24,6 @@ prompt() {
# Add terminating "$" or "#" sign
PS1=$PS1'%#'
- # Add > symbols to show nested shells
- local shlvl
- for ((shlvl = 1; shlvl < SHLVL; shlvl++)) ; do
- PS1='>'$PS1
- done
-
# Bold and color the prompt if it looks like we can
if (( $({ tput colors || tput Co ; } 2>/dev/null) >= 8 )) ; then
PS1='%B%F{cyan}'$PS1'%f%b'