feat tmux: add mode in statusbar

This commit is contained in:
Yuan Chiu 2025-06-01 18:10:52 +08:00
parent 85f7f9a560
commit d72a49c2db
Signed by: yuan
GPG Key ID: 50FBE4156404B98D

View File

@ -2,6 +2,9 @@
set -g mouse on
set -g mode-keys vi
# 讓終端支援 Truecolor
set-option -ga terminal-overrides ',*:Tc'
# == TPM Configure ============================================================
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
@ -12,8 +15,43 @@ set -g @plugin 'tmux-plugins/tmux-sensible'
# set -g @plugin 'github_username/plugin_name#branch'
# set -g @plugin 'git@github.com:user/plugin'
# set -g @plugin 'git@bitbucket.com:user/plugin'
# set -g @plugin 'MunifTanjim/tmux-mode-indicator'
set -g @plugin 'aacebedo/tmux-mode-indicator'
# == Plugin Configure =========================================================
# ---- tmux-mode-indicator ----------------------------------------------------
# prompt to display when tmux prefix key is pressed
set -g @mode_indicator_prefix_prompt ' WAIT '
# prompt to display when tmux is in copy mode
set -g @mode_indicator_copy_prompt " COPY "
# prompt to display when tmux has synchronized panes
set -g @mode_indicator_sync_prompt ' SYNC '
# prompt to display when tmux is in normal mode
set -g @mode_indicator_empty_prompt ' TMUX '
# add an element at the start of the indicator in <mode> mode (replace it with prefix, copy, sync or empty)
set -g @mode_indicator_prefix_end_prompt ''
set -g @mode_indicator_copy_end_prompt ''
set -g @mode_indicator_sync_end_prompt ''
set -g @mode_indicator_empty_end_prompt ''
# style values for prefix prompt
set -g @mode_indicator_prefix_mode_style 'bg=blue,fg=black'
# style values for copy prompt
set -g @mode_indicator_copy_mode_style 'bg=yellow,fg=black'
# style values for sync prompt
set -g @mode_indicator_sync_mode_style 'bg=red,fg=black'
# style values for empty prompt
set -g @mode_indicator_empty_mode_style 'bg=cyan,fg=black'
# stàle the element at the start of the indicator in <mode> mode (replace it with prefix, copy, sync or empty)
set -g @mode_indicator_prefix_mode_end_style 'fg=blue,bg=black'
set -g @mode_indicator_copy_mode_end_style 'fg=yellow,bg=black'
set -g @mode_indicator_sync_mode_end_style 'fg=red,bg=black'
set -g @mode_indicator_empty_mode_end_style 'fg=cyan,bg=black'
# == StatusBar Configure ======================================================
# tmux show-options -g | grep status-left
set -g status-interval 1
@ -24,7 +62,7 @@ set -g status-right-length 100
set -g status-bg default
set -g status-fg white
set -g status-style "bg=black,fg=white"
set -g status-left "[#{session_name}] "
set -g status-left "#{tmux_mode_indicator} [#{session_name}] "
set -g status-right "#{?window_bigger,[#{window_offset_x}#,#{window_offset_y}] ,}\"#{=21:pane_title}\" %H:%M %d-%b-%y"
# set -g status-left '#{tmux_mode_indicator}#[fg=colour240]#(whoami)'
# set -g status-left '#{tmux_mode_indicator}#[fg=colour240]#[fg=colour255,bg=colour240] #(whoami) #[fg=colour240,bg=default]'