05037e40d8
The block came from the agent-deck installer and was carried in wholesale when the config was ported to nix. The tool is not installed on any host and nothing else references it, and now that the file is rendered read-only from the nix store the installer could not update its own block anyway. It re-declared default-terminal, history-limit and mouse at their existing values, and escape-time at 0 — which quietly overrode the deliberate 25ms two sections above it, along with the comment explaining that 0 breaks Alt keys over SSH. Keeps the parts that do real work: the alternate-screen override, extended keys, and the mouse scroll and drag-to-copy bindings. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
152 lines
5.0 KiB
Bash
152 lines
5.0 KiB
Bash
# Set prefix to Ctrl-a (more ergonomic than Ctrl-b)
|
|
set -g prefix C-a
|
|
unbind C-b
|
|
bind C-a send-prefix
|
|
|
|
# Enable mouse support
|
|
set -g mouse on
|
|
|
|
# Start windows and panes at 1, not 0
|
|
set -g base-index 1
|
|
setw -g pane-base-index 1
|
|
|
|
# Renumber windows when one is closed
|
|
set -g renumber-windows on
|
|
|
|
# Increase scrollback buffer
|
|
set -g history-limit 50000
|
|
|
|
# Low escape-time (0 breaks Alt keys over SSH; 25ms is a good balance)
|
|
set -s escape-time 25
|
|
|
|
# Enable 256 colors
|
|
set -g default-terminal "tmux-256color"
|
|
set -ag terminal-overrides ",xterm-256color:RGB"
|
|
set -ag terminal-overrides ",*256col*:Tc"
|
|
|
|
# smcup@/rmcup@ drops the alternate screen, so what tmux drew stays in the
|
|
# outer terminal's scrollback instead of vanishing when tmux exits.
|
|
set -ag terminal-overrides ",xterm*:Tc:smcup@:rmcup@"
|
|
|
|
# Forward Shift+Enter and other modified keys through to applications
|
|
set -s extended-keys on
|
|
set -as terminal-features "tmux-256color:extkeys"
|
|
|
|
# -------------------------------------------------------------------
|
|
# Status bar theme
|
|
# -------------------------------------------------------------------
|
|
set -g status-position bottom
|
|
set -g status-interval 5
|
|
set -g status-style "bg=#1a1b26,fg=#a9b1d6"
|
|
|
|
# Left: session name
|
|
set -g status-left-length 30
|
|
set -g status-left "#[fg=#1a1b26,bg=#7aa2f7,bold] #S #[fg=#7aa2f7,bg=#1a1b26,nobold] "
|
|
|
|
# Right: continuum status + time
|
|
set -g status-right-length 50
|
|
set -g status-right "#[fg=#565f89] #{?client_prefix,#[fg=#e0af68]PREFIX ,}#[fg=#565f89,bg=#1a1b26] %H:%M #[fg=#1a1b26,bg=#7aa2f7,bold] %d %b "
|
|
|
|
# Window tabs
|
|
set -g window-status-format "#[fg=#565f89] #I #W "
|
|
set -g window-status-current-format "#[fg=#7aa2f7,bg=#24283b,bold] #I #W #[fg=#24283b,bg=#1a1b26]"
|
|
set -g window-status-separator ""
|
|
|
|
# Pane borders
|
|
set -g pane-border-style "fg=#3b4261"
|
|
set -g pane-active-border-style "fg=#7aa2f7"
|
|
|
|
# Message style
|
|
set -g message-style "fg=#7aa2f7,bg=#1a1b26,bold"
|
|
set -g message-command-style "fg=#7aa2f7,bg=#1a1b26"
|
|
|
|
# Copy mode
|
|
setw -g mode-style "fg=#1a1b26,bg=#7aa2f7"
|
|
|
|
# Easy config reload
|
|
bind r source-file ~/.tmux.conf \; display "Config reloaded!"
|
|
|
|
# Better pane splitting (use current path)
|
|
bind \\ split-window -h -c "#{pane_current_path}"
|
|
bind - split-window -v -c "#{pane_current_path}"
|
|
unbind '"'
|
|
unbind %
|
|
|
|
# New window in current path
|
|
bind c new-window -c "#{pane_current_path}"
|
|
|
|
# Pane resize (if you ever use tmux panes)
|
|
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
|
|
|
|
# Quick window switching (prefix + number)
|
|
bind 1 select-window -t 1
|
|
bind 2 select-window -t 2
|
|
bind 3 select-window -t 3
|
|
bind 4 select-window -t 4
|
|
bind 5 select-window -t 5
|
|
bind 6 select-window -t 6
|
|
bind 7 select-window -t 7
|
|
bind 8 select-window -t 8
|
|
bind 9 select-window -t 9
|
|
|
|
# Window navigation (prefix + h/l)
|
|
bind h previous-window
|
|
bind l next-window
|
|
|
|
# Session navigation (prefix + j/k/S)
|
|
bind j switch-client -n # next session
|
|
bind k switch-client -p # previous session
|
|
bind S choose-tree -sZ # session tree picker
|
|
|
|
# Move windows left/right
|
|
bind -r < swap-window -t -1\; select-window -t -1
|
|
bind -r > swap-window -t +1\; select-window -t +1
|
|
|
|
# Enable vi mode for copy
|
|
setw -g mode-keys vi
|
|
bind -T copy-mode-vi v send -X begin-selection
|
|
bind -T copy-mode-vi y send -X copy-selection-and-cancel
|
|
|
|
# -------------------------------------------------------------------
|
|
# Clipboard (OSC 52)
|
|
# -------------------------------------------------------------------
|
|
set -g set-clipboard on
|
|
|
|
# tmux silently skips OSC 52 unless the outer terminal's terminfo claims the
|
|
# capability. kitty's does; SSH sessions usually land on a bare
|
|
# xterm-256color that does not, so declare both.
|
|
set -ag terminal-features ",xterm-kitty:clipboard"
|
|
set -ag terminal-features ",xterm-256color:clipboard"
|
|
|
|
# Let nvim's OSC 52 provider reach the outer terminal through tmux.
|
|
set -g allow-passthrough on
|
|
|
|
# Drag-to-copy. No external command: set-clipboard routes this through
|
|
# OSC 52, which works on Wayland and over SSH. xclip did neither.
|
|
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel
|
|
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel
|
|
|
|
# -------------------------------------------------------------------
|
|
# Mouse scrolling
|
|
# -------------------------------------------------------------------
|
|
# Scrolling up enters copy-mode, unless the pane's application wants the
|
|
# mouse itself or we are already in copy-mode.
|
|
bind-key -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
|
|
|
|
bind-key -T copy-mode-vi WheelUpPane send-keys -X scroll-up
|
|
bind-key -T copy-mode-vi WheelDownPane send-keys -X scroll-down
|
|
bind-key -T copy-mode WheelUpPane send-keys -X scroll-up
|
|
bind-key -T copy-mode WheelDownPane send-keys -X scroll-down
|
|
|
|
|
|
# tmux-resurrect settings
|
|
set -g @resurrect-capture-pane-contents 'on'
|
|
set -g @resurrect-strategy-nvim 'session'
|
|
|
|
# tmux-continuum settings (auto-save and auto-restore)
|
|
set -g @continuum-restore 'on'
|
|
set -g @continuum-save-interval '10'
|