Proper tmux session list padding, tmux status bar on by default

This commit is contained in:
Daniel Flanagan 2017-04-25 11:44:13 -05:00
parent 4c28d08606
commit d777bc08da
2 changed files with 7 additions and 9 deletions

View file

@ -8,19 +8,17 @@ export CUR_SESSION_PREFIX="#[bg=colour1] "
export CUR_SESSION_SUFFIX=" #[bg=default]" export CUR_SESSION_SUFFIX=" #[bg=default]"
if [ -z "$1" ]; then if [ -z "$1" ]; then
# debug_msg 'No current session passed'
export CUR_TMUX_SESSION="$(tmux display-message -p '#S')" export CUR_TMUX_SESSION="$(tmux display-message -p '#S')"
else else
export CUR_TMUX_SESSION="$1" export CUR_TMUX_SESSION="$1"
fi fi
# debug_msg "Current tmux session name: $CUR_TMUX_SESSION"
export TMUX_SESSION_LIST="$(tmux list-sessions | sed -ne 's/^\([^:]*\).*$/ \1 /p' | tr '\n' ' ' | xargs)" export TMUX_SESSION_LIST=" $(tmux list-sessions | sed -ne 's/^\([^:]*\).*$/ \1 /p' | tr '\n' ' ' | xargs)"
# debug_msg "Running tmux sessions: $TMUX_SESSION_LIST"
HIGHLIGHT_CUR_SESSION="${TMUX_SESSION_LIST/$CUR_TMUX_SESSION/${CUR_SESSION_PREFIX}${CUR_TMUX_SESSION}${CUR_SESSION_SUFFIX}}"
HIGHLIGHT_CUR_SESSION="${TMUX_SESSION_LIST/ $CUR_TMUX_SESSION / ${CUR_SESSION_PREFIX}${CUR_TMUX_SESSION}${CUR_SESSION_SUFFIX} }"
ADD_END_SPACE_IF_NECESSARY=$(echo "$HIGHLIGHT_CUR_SESSION" | sed -e 's/\([^]]\)$/\ /p') ADD_END_SPACE_IF_NECESSARY=$(echo "$HIGHLIGHT_CUR_SESSION" | sed -e 's/\([^]]\)$/\ /p')
# debug_msg "Transformed tmux session list: -$ADD_END_SPACE_IF_NECESSARY-" REMOVE_START_SPACE_IF_NECESSARY=$(echo "$ADD_END_SPACE_IF_NECESSARY" | sed 's/^ #/#/')
echo "$ADD_END_SPACE_IF_NECESSARY" echo "$REMOVE_START_SPACE_IF_NECESSARY"

View file

@ -25,7 +25,7 @@ unbind r
bind r source-file ~/.tmux.conf bind r source-file ~/.tmux.conf
# hide tmux status bar by default (prefix H toggles) # hide tmux status bar by default (prefix H toggles)
set -g status off # set -g status off
# toggle status bar hotkey # toggle status bar hotkey
bind-key H set status bind-key H set status
@ -47,7 +47,7 @@ set -g status-left ''
set -g status-right '' set -g status-right ''
set -g status-right-length 20 set -g status-right-length 20
set -g status-left '#(#{DOTFILES_PATH}/scripts/bin/tmux-session-list #S)' set -g status-left '#(#{DOTFILES_PATH}/scripts/bin/tmux-session-list #S)'
set -g status-left-length 80 set -g status-left-length 80
setw -g window-status-current-fg colour7 setw -g window-status-current-fg colour7