diff --git a/tmux/.tmux.conf.local b/tmux/.tmux.conf.local index 8ce02ab..1ea9fd6 100644 --- a/tmux/.tmux.conf.local +++ b/tmux/.tmux.conf.local @@ -366,36 +366,22 @@ 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. +# ── Mode indicator (always-on, Neovim-style) ────────────────────────────────── +# NORMAL = working in tmux (default, always visible) +# VISUAL = in copy-mode (prefix + Enter) # -# Clear indicator when exiting copy-mode +# #{@mode_indicator} is a window user-option set via pane-mode-changed hook. +# We use -F flag so #{pane_in_mode} is evaluated as a tmux format (1=in mode). +# This bypasses oh-my-tmux's awk pipeline which mangles inline #{?...} conditionals. + +# Set NORMAL as the default on startup +set-window-option -g @mode_indicator "#[fg=#25be6a,bold] NORMAL " + +# Switch between NORMAL and VISUAL whenever the pane mode changes 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 \"" -} + 'if-shell -F "#{pane_in_mode}" \ + "set-window-option -g @mode_indicator \"#[fg=#78a9ff,bold] VISUAL \"" \ + "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