20 lines
837 B
Bash
Executable file
20 lines
837 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
CUR_SESSION_PREFIX="#[bg=colour1]"
|
|
CUR_SESSION_SUFFIX="#[bg=default]"
|
|
|
|
export CUR_TMUX_SESSION="$1"
|
|
if [ -z "$1" ]; then
|
|
export CUR_TMUX_SESSION="$(tmux display-message -p '#S')"
|
|
fi
|
|
|
|
TMUX_SESSION_LIST="$(tmux list-sessions | sed -ne 's/^\([^:]*\).*$/ \1 /p' | tr -d '\n')"
|
|
|
|
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')
|
|
REMOVE_START_SPACE_IF_NECESSARY=$(echo "$HIGHLIGHT_CUR_SESSION" | sed 's/^ #/#/')
|
|
|
|
echo "cursess: $CUR_TMUX_SESSION -- sesslist: $TMUX_SESSION_LIST -- withhili: $HIGHLIGHT_CUR_SESSION -- cutspace: $REMOVE_START_SPACE_IF_NECESSARY -- argv1: $1 -- TMUX: $TMUX" >> ~/.tmux.log
|
|
|
|
echo "$REMOVE_START_SPACE_IF_NECESSARY -- $1"
|