status-right-length was 451 on a 158-column terminal. tmux lays out the left segment, then the window list, then gives what is left to the right segment -- and with the right declared three times wider than the screen there is no stable allocation. Anything that changes the window list's rendered width pushes the right segment off entirely, which is why the IP and clock kept vanishing while the left side stayed put. The window formats render to 92 characters because of the nested conditionals that pick a circled number per index, so the list is wide enough to matter. This is what the "seizure" was. Not X, not NVIDIA, not picom, not hotplug events, not the monitors, not mosh, not tmux's version, and not the shell substitution in status-right -- it reproduced on a bare framebuffer console with none of those present, and it was intermittent because it depended on what the window list happened to render at that moment.
117 lines
5.2 KiB
Bash
117 lines
5.2 KiB
Bash
# Ring the bell if any background window rang a bell
|
||
set -g bell-action any
|
||
|
||
# Default termtype. If the rcfile sets $TERM, that overrides this value.
|
||
set -g default-terminal "tmux-256color"
|
||
|
||
# Truecolor + clipboard passthrough for outer terminals that advertise RGB
|
||
# (covers xterm-*, alacritty, kitty, wezterm, iTerm, ghostty, modern Apple Terminal).
|
||
set -ga terminal-features ",xterm-256color:RGB"
|
||
set -ga terminal-features ",alacritty:RGB"
|
||
set -ga terminal-features ",kitty:RGB"
|
||
set -ga terminal-features ",wezterm:RGB"
|
||
set -ga terminal-features ",ghostty:RGB"
|
||
set -ga terminal-features ",screen-256color:RGB"
|
||
|
||
# TUI apps (Claude Code, nvim, etc.) want focus events so they can redraw
|
||
# / refresh state when the pane regains focus.
|
||
set -g focus-events on
|
||
|
||
# Keep your finger on ctrl, or don't
|
||
bind-key ^D detach-client
|
||
|
||
# Create splits and vertical splits
|
||
bind-key v split-window -h -p 50 -c "#{pane_current_path}"
|
||
bind-key ^V split-window -h -p 50 -c "#{pane_current_path}"
|
||
bind-key s split-window -p 50 -c "#{pane_current_path}"
|
||
bind-key ^S split-window -p 50 -c "#{pane_current_path}"
|
||
|
||
# Pane resize in all four directions using vi bindings.
|
||
# Can use these raw but I map them to shift-ctrl-<h,j,k,l> in iTerm.
|
||
bind -r H resize-pane -L 5
|
||
bind -r J resize-pane -D 5
|
||
bind -r K resize-pane -U 5
|
||
bind -r L resize-pane -R 5
|
||
|
||
# Smart pane switching with awareness of Vim splits.
|
||
# See: https://github.com/christoomey/vim-tmux-navigator
|
||
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
||
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
|
||
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
|
||
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
|
||
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
|
||
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
|
||
|
||
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
|
||
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
|
||
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
|
||
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
|
||
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
|
||
|
||
bind-key -T copy-mode-vi 'C-h' select-pane -L
|
||
bind-key -T copy-mode-vi 'C-j' select-pane -D
|
||
bind-key -T copy-mode-vi 'C-k' select-pane -U
|
||
bind-key -T copy-mode-vi 'C-l' select-pane -R
|
||
bind-key -T copy-mode-vi 'C-\' select-pane -l
|
||
|
||
# Use vi keybindings for tmux commandline input.
|
||
# Note that to get command mode you need to hit ESC twice...
|
||
set -g status-keys vi
|
||
|
||
# Use vi keybindings in copy and choice modes
|
||
setw -g mode-keys vi
|
||
|
||
# easily toggle synchronization (mnemonic: e is for echo)
|
||
# sends input to all panes in a given window.
|
||
bind e setw synchronize-panes on
|
||
bind E setw synchronize-panes off
|
||
|
||
# set first window to index 1 (not 0) to map more to the keyboard layout...
|
||
set-option -g base-index 1
|
||
set-window-option -g pane-base-index 1
|
||
set-window-option -g mouse off
|
||
|
||
# color scheme (styled as vim-powerline)
|
||
set -g status-left-length 52
|
||
set -g status-right-length 60
|
||
set -g status-style fg=white,bg=colour234
|
||
set -g pane-border-style fg=colour245
|
||
set -g pane-active-border-style fg=colour39
|
||
set -g message-style fg=colour16,bg=colour221,bold
|
||
set -g status-left '#[fg=colour235,bg=colour252,bold] ❐ #S #[fg=colour252,bg=colour238,nobold]❯#[fg=colour245,bg=colour238,bold] #(whoami) '
|
||
set -g status-right '#[bold][#[nobold,fg=colour229]#h#[fg=default] / #[fg=colour229]#(~/.local/bin/tmux-net)#[fg=default,bold]]#[nobold,fg=colour255] %-I:%M%P %d-%b-%Y '
|
||
set -g window-status-format '#[fg=colour235,bg=colour252,nobold] #{?#{==:#{window_index},1},❶,#{?#{==:#{window_index},2},❷,#{?#{==:#{window_index},3},❸,#{?#{==:#{window_index},4},❹,#{?#{==:#{window_index},5},❺,#{?#{==:#{window_index},6},❻,#{?#{==:#{window_index},7},❼,#{?#{==:#{window_index},8},❽,#{?#{==:#{window_index},9},❾,#{?#{==:#{window_index},10},❿,#{window_index}}}}}}}}}}} #{b:pane_current_path} #W '
|
||
set -g window-status-current-format '#[fg=colour234,bg=colour39,bold] [#[fg=colour232,bold]#{?window_zoomed_flag,#[fg=colour228],} #{?#{==:#{window_index},1},❶,#{?#{==:#{window_index},2},❷,#{?#{==:#{window_index},3},❸,#{?#{==:#{window_index},4},❹,#{?#{==:#{window_index},5},❺,#{?#{==:#{window_index},6},❻,#{?#{==:#{window_index},7},❼,#{?#{==:#{window_index},8},❽,#{?#{==:#{window_index},9},❾,#{?#{==:#{window_index},10},❿,#{window_index}}}}}}}}}}} #{b:pane_current_path} #W #[fg=colour234,bold]] '
|
||
set-option -g status-interval 60
|
||
|
||
# Patch for OS X pbpaste and pbcopy under tmux.
|
||
set-option -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL"
|
||
|
||
# Screen like binding
|
||
unbind C-b
|
||
set -g prefix C-a
|
||
bind a send-prefix
|
||
|
||
# No escape time for vi mode
|
||
set -sg escape-time 0
|
||
|
||
# Screen like binding for last window
|
||
unbind l
|
||
bind C-a last-window
|
||
|
||
# Bigger history
|
||
set -g history-limit 80000
|
||
|
||
# New windows/pane in $PWD
|
||
bind c new-window -c "#{pane_current_path}"
|
||
|
||
# Fix key bindings broken in tmux 2.1
|
||
set -g assume-paste-time 0
|
||
|
||
# force a reload of the config file
|
||
unbind r
|
||
bind r source-file ~/.tmux.conf \; display "Reloaded!"
|
||
|
||
# Local config
|
||
if-shell "[ -f ~/.tmux.conf.user ]" 'source ~/.tmux.conf.user'
|