fix(tmux): fix NORMAL/VISUAL mode indicators
The #{?pane_in_mode,...} inline conditional was getting mangled by
oh-my-tmux's awk/sed pipeline that processes tmux_conf_theme_status_right.
Fix: use #{@mode_indicator} user-option in status_right, driven by:
- bind Enter → sets NORMAL indicator (green) on copy-mode entry
- bind v → sets VISUAL indicator (blue) on selection start
- bind y/Esc → clears indicator on copy/exit
- pane-mode-changed hook → clears indicator when mode exits
Also fixed: encoding artifacts in status_right, missing bullet separator.
This commit is contained in:
+32
-1
@@ -263,7 +263,7 @@ tmux_conf_theme_status_left_fg="default"
|
||||
tmux_conf_theme_status_left_bg="default"
|
||||
tmux_conf_theme_status_left_attr="none"
|
||||
|
||||
tmux_conf_theme_status_right=" #{prefix}#{mouse}#{pairing}#{synchronized}#{?pane_in_mode,#{?selection_active,#[fg=$color_blue,bg=default,bold] VISUAL,#[fg=$color_green,bg=default,bold] NORMAL},} | #[fg=$color_fg,bg=default,none] #{?uptime_d,#{uptime_d}d,}#{?uptime_h,#{uptime_h}h,}#{?uptime_m,#{uptime_m}m,} #[fg=$color_gray]│ #[fg=$color_cyan,bg=default,bold] %d %b %H:%M #[fg=$color_gray]│ #[fg=$color_purple,bg=default,bold] #{username}#{root}@#{hostname}"
|
||||
tmux_conf_theme_status_right=" #{prefix}#{mouse}#{pairing}#{synchronized}#{@mode_indicator} | #[fg=$color_fg,bg=default,none] #{?uptime_d,#{uptime_d}d,}#{?uptime_h,#{uptime_h}h,}#{?uptime_m,#{uptime_m}m,} #[fg=$color_gray]│ #[fg=$color_cyan,bg=default,bold] %d %b %H:%M #[fg=$color_gray]│ #[fg=$color_purple,bg=default,bold] #{username}#{root}@#{hostname}"
|
||||
|
||||
# status right style
|
||||
tmux_conf_theme_status_right_fg="$color_red,$color_fg"
|
||||
@@ -366,6 +366,37 @@ source-file "/Users/jsarthak/dotfiles/tmux/config/keybindings.conf"
|
||||
|
||||
setw -g window-status-separator " #[fg=#484848]• " #!important
|
||||
|
||||
# ── Mode indicators via hooks ─────────────────────────────────────────────────
|
||||
# oh-my-tmux's awk pipeline mangles #{?pane_in_mode,...} inline conditionals,
|
||||
# so we drive @mode_indicator via hooks instead.
|
||||
#
|
||||
# Clear indicator when exiting copy-mode
|
||||
set-hook -g pane-mode-changed \
|
||||
'if-shell "tmux display-message -p \"#{pane_in_mode}\" | grep -q 1" \
|
||||
"" \
|
||||
"set-window-option -g @mode_indicator \"\""'
|
||||
#
|
||||
# NORMAL mode (entered copy-mode, no selection yet)
|
||||
bind-key -T copy-mode-vi Escape { send -X cancel; set-window-option -g @mode_indicator "" }
|
||||
bind-key -T copy-mode-vi v {
|
||||
send -X begin-selection
|
||||
set-window-option -g @mode_indicator "#[fg=#78a9ff,bold] VISUAL "
|
||||
}
|
||||
bind-key -T copy-mode-vi y {
|
||||
send -X copy-selection-and-cancel
|
||||
set-window-option -g @mode_indicator ""
|
||||
}
|
||||
# Set NORMAL indicator on copy-mode entry (overrides keybindings.conf Enter bind)
|
||||
bind Enter {
|
||||
copy-mode
|
||||
set-window-option -g @mode_indicator "#[fg=#25be6a,bold] NORMAL "
|
||||
}
|
||||
bind -T root MouseDrag1Pane {
|
||||
if-shell -F "#{||:#{pane_in_mode},#{mouse_any_flag}}" \
|
||||
"send-keys -M" \
|
||||
"copy-mode -e; set-window-option -g @mode_indicator \"#[fg=#25be6a,bold] NORMAL \""
|
||||
}
|
||||
|
||||
# ── Per-machine local override (untracked) ────────────────────────────────────
|
||||
# Create ~/.tmux.conf.machine.local on each machine for host-specific tweaks
|
||||
# (e.g. different color scheme, right-side content, etc.)
|
||||
|
||||
Reference in New Issue
Block a user