Add mode indicator to statusline (pretty big hack ATM)
This commit is contained in:
parent
0fc1fdb82e
commit
caad7d000a
2 changed files with 31 additions and 1 deletions
30
dot-config/tmux-powerline/segments/mode_indicator.sh
Normal file
30
dot-config/tmux-powerline/segments/mode_indicator.sh
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Indicator of pressing TMUX prefix, copy and insert modes.
|
||||||
|
declare -A MODE_BG MODE_LABEL
|
||||||
|
MODE_BG=(
|
||||||
|
[P]=blue
|
||||||
|
[C]=yellow
|
||||||
|
[S]=red
|
||||||
|
[T]=cyan
|
||||||
|
)
|
||||||
|
MODE_LABEL=(
|
||||||
|
[P]=WAIT
|
||||||
|
[C]=COPY
|
||||||
|
[S]=SYNC
|
||||||
|
[T]=TMUX
|
||||||
|
)
|
||||||
|
|
||||||
|
__choose_for_mode() {
|
||||||
|
local -n modes=$1
|
||||||
|
echo -n "#{?client_prefix,${modes[P]},#{?pane_in_mode,${modes[C]},#{?pane_synchronized,${modes[S]},${modes[T]}}}}"
|
||||||
|
}
|
||||||
|
|
||||||
|
__update_segment_bg() {
|
||||||
|
export TMUX_POWERLINE_CUR_SEGMENT_BG="$(tmux display-message -p "$(__choose_for_mode MODE_BG)")"
|
||||||
|
}
|
||||||
|
__update_segment_bg
|
||||||
|
|
||||||
|
run_segment() {
|
||||||
|
echo -n "#[fg=black,bg=$(__choose_for_mode MODE_BG)] $(__choose_for_mode MODE_LABEL)"
|
||||||
|
return 0
|
||||||
|
}
|
|
@ -93,7 +93,7 @@ fi
|
||||||
|
|
||||||
if [[ -z $TMUX_POWERLINE_LEFT_STATUS_SEGMENTS ]]; then
|
if [[ -z $TMUX_POWERLINE_LEFT_STATUS_SEGMENTS ]]; then
|
||||||
TMUX_POWERLINE_LEFT_STATUS_SEGMENTS=(
|
TMUX_POWERLINE_LEFT_STATUS_SEGMENTS=(
|
||||||
"mode_indicator 33"
|
"mode_indicator default default ${TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD} default default both_disable"
|
||||||
#"tmux_session_info 148 234"
|
#"tmux_session_info 148 234"
|
||||||
#"hostname 33 0"
|
#"hostname 33 0"
|
||||||
#"ifstat 30 255"
|
#"ifstat 30 255"
|
||||||
|
|
Loading…
Reference in a new issue