From 5c4a1675abd27204c313018783894817e0445a5b Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 23 Aug 2016 10:33:27 +1200 Subject: Experiment with abbreviated prompt And an even more strict tmux environment --- bash/bashrc.d/prompt.bash | 7 +++++-- tmux/tmux.conf.m4 | 25 ++++++++++++------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index e61b69d5..2559d9d8 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -15,8 +15,11 @@ prompt() { # If Bash 4.0 is available, trim very long paths in prompt ((BASH_VERSINFO[0] >= 4)) && PROMPT_DIRTRIM=4 - # Basic prompt shape - PS1='\u@\h:\w' + # Basic prompt shape depends on whether we're in SSH or not + PS1= + [[ -n $SSH_CONNECTION ]] && + PS1=$PS1'\u@\h:' + PS1=$PS1'\w' # Add sub-commands; VCS, job, and return status checks PS1=$PS1'$(prompt vcs)$(prompt job)$(prompt ret)' diff --git a/tmux/tmux.conf.m4 b/tmux/tmux.conf.m4 index f7fc1e8e..624047ec 100644 --- a/tmux/tmux.conf.m4 +++ b/tmux/tmux.conf.m4 @@ -1,23 +1,22 @@ -# My tmux session is no-display land because I attach to it with all sorts of -# terminal clients, including PuTTY, so I don't always have X forwarding -# available and therefore it's not appropriate to set the display +# Strip out a lot of machine and X11 dependent crap from the initial +# environment +set-environment -gru COLORFGBG +set-environment -gru COLORTERM set-environment -gru DISPLAY +set-environment -gru SSH_CLIENT +set-environment -gru SSH_CONNECTION +set-environment -gru SSH_TTY +set-environment -gru WINDOWID -# Force the browser to be Lynx in case we inherited a non-null DISPLAY -set-environment -g BROWSER 'lynx' - -# The only environment variables I want tmux to update for me are SSH_CLIENT, -# SSH_CONNECTION, and SSH_TTY, all of which are occasionally useful -set-option -g update-environment 'SSH_CLIENT SSH_CONNECTION SSH_TTY' +# 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 set-option -g default-command "$SHELL" -# All of my terminals are 256 colors, so use the appropriate termcap/terminfo, -# and unset COLORFGBG and COLORTERM to stop programs getting confused +# Expect a 256-color terminal set-option -g default-terminal 'screen-256color' -set-environment -gru COLORFGBG -set-environment -gru COLORTERM # Change the prefix to ^A rather than the default of ^B, because I'm a godless # GNU Screen refugee, and also I like using ^B in my shell and in Vim more -- cgit v1.2.3