# ============================================ # TMUX CONFIGURATION # ============================================ # --- TERMINAL & TRUE COLOR --- set -g default-terminal "tmux-256color" set -ag terminal-overrides ",*:RGB" set -ag terminal-overrides ",*:Tc" # Keep clipboard/display env fresh for long-lived or restored tmux servers. # Without WAYLAND_DISPLAY, wl-copy silently fails and mouse selections vanish. set -g update-environment "DISPLAY WAYLAND_DISPLAY XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS SSH_AUTH_SOCK SSH_AGENT_PID WINDOWID XAUTHORITY" # --- GENERAL --- set -g mouse on setw -g mode-keys vi set -g base-index 1 setw -g pane-base-index 1 set -g renumber-windows on set -g escape-time 0 set -g focus-events on set -g extended-keys on set -g default-shell ZSHELL_PATH # --- COPY-PASTE (OSC 52 + tmux-yank for Linux/Wayland) --- # OSC 52: terminal-native clipboard, works over SSH set -g set-clipboard on # tmux-yank: improved copy/paste with mouse support set -g @yank_selection 'clipboard' set -g @yank_selection_mouse 'clipboard' set -g @yank_with_mouse on set -g @yank_action 'copy-pipe-and-cancel' # --- DEFAULT COLORS (Graphite - Contrast Corrected) --- set -g status-style 'bg=#141414,fg=#b8bcc0' set -g status-justify centre set -g status on set -g status-left-length 60 set -g status-right-length 140 set -g status-interval 2 # Single-line status bar (context only, shortcuts line disabled) # NOTE: status-format[0] is authoritative when present; keep context here. set -g status-format[0] '#[align=left]#S #{pane_current_command}#{?client_prefix, PREFIX,}#[align=right]#(~/.tmux/scripts/git-pane-status.sh "#{pane_id}" "#{pane_current_path}") %H:%M' set -gu status-format[1] set -g status-left '' set -g status-right '' # Shortcuts line (disabled for now): # set -g status 2 # set -g status-format[0] '#[align=centre]C-b | split-h - split-v c new-win n/p win d detach z zoom x kill-pane s tree $ rename' # set -g status-format[1] '#[align=left]#S #{pane_current_command}#{?client_prefix, PREFIX,}#[align=right]#(~/.tmux/scripts/git-pane-status.sh "#{pane_id}" "#{pane_current_path}") %H:%M' setw -g window-status-style 'bg=#141414,fg=#8a8f94' setw -g window-status-current-style 'bg=#141414,fg=#c6cacf,bold' setw -g window-status-format ' #I:#W ' setw -g window-status-current-format ' #I:#W* ' set -g window-style 'bg=#141414,fg=#8a8f94' set -g window-active-style 'bg=#141414,fg=#b8bcc0' set -g pane-border-style 'fg=#303030,bg=#141414' set -g pane-active-border-style 'fg=#6f767d,bg=#141414' set -g pane-border-lines single set -g message-style 'bg=#222222,fg=#c6cacf' # --- SESSION-BASED THEMING --- set-hook -g after-new-session 'run-shell -b "~/.tmux/apply-theme-hook.sh"' # --- KEYBINDS --- # Reload config bind r source-file ~/.tmux.conf \; display-message "Config reloaded!" # Split panes keeping current path bind | split-window -h -c "#{pane_current_path}" \; refresh-client -S bind - split-window -v -c "#{pane_current_path}" \; refresh-client -S # Vim-style pane navigation (force immediate status refresh) bind h select-pane -L \; refresh-client -S bind j select-pane -D \; refresh-client -S bind k select-pane -U \; refresh-client -S bind l select-pane -R \; refresh-client -S # Resize 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 # New window keeping current path bind c new-window -c "#{pane_current_path}" \; refresh-client -S # --- PLUGINS (TPM) --- set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-yank' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @resurrect-capture-pane-contents 'on' set -g @plugin 'tmux-plugins/tmux-continuum' set -g @continuum-restore 'on' set -g @continuum-boot 'on' set -g @continuum-boot-options 'new-session' run '~/.tmux/plugins/tpm/tpm' # --- VI COPY-MODE --- # Explicit portable copy bindings. The helper uses native clipboard tools locally # and falls back to tmux OSC52 over SSH/VPS. set -s copy-command '$HOME/.tmux/scripts/copy-to-clipboard.sh' bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel '$HOME/.tmux/scripts/copy-to-clipboard.sh' bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel '$HOME/.tmux/scripts/copy-to-clipboard.sh' bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel '$HOME/.tmux/scripts/copy-to-clipboard.sh' bind -T copy-mode-vi DoubleClick1Pane select-pane \; send-keys -X select-word \; send-keys -X copy-pipe-and-cancel '$HOME/.tmux/scripts/copy-to-clipboard.sh' bind -T copy-mode-vi TripleClick1Pane select-pane \; send-keys -X select-line \; send-keys -X copy-pipe-and-cancel '$HOME/.tmux/scripts/copy-to-clipboard.sh' bind -T copy-mode-vi v send-keys -X begin-selection bind -T copy-mode-vi C-v send-keys -X rectangle-toggle bind -T copy-mode-vi Escape send-keys -X clear-selection # Paste from tmux buffer (in normal mode) bind p paste-buffer # --- CHECK CLIPBOARD CONFIGURATION --- bind ? display-message -p \ "Mouse: #{?mouse} | Clipboard: #{?set-clipboard} | OSC 52: #{?copy-mode-vi} | tmux-yank: #{?yank_selection}" # --- STATUS BAR REFRESH HOOKS (focus-aware, aggressive) --- set-hook -g after-select-pane 'refresh-client -S' set-hook -g after-select-window 'refresh-client -S' set-hook -g client-session-changed 'refresh-client -S' set-hook -g pane-focus-in 'refresh-client -S' set-hook -g after-split-window 'refresh-client -S' set-hook -g after-new-window 'refresh-client -S' set-hook -g pane-exited 'refresh-client -S'