Skip to content

Instantly share code, notes, and snippets.

@utarn
Last active August 3, 2026 00:05
Show Gist options
  • Select an option

  • Save utarn/5993ce2c0a970e2e6a3a191ac75a884e to your computer and use it in GitHub Desktop.

Select an option

Save utarn/5993ce2c0a970e2e6a3a191ac75a884e to your computer and use it in GitHub Desktop.
Modern Tmux Configuration for Remote SSH
# ==============================================================================
# Modern Tmux Configuration for Remote SSH (Windows & macOS clients)
# ==============================================================================
# --- General & Performance ---
set -g default-terminal "screen-256color"
set -as terminal-overrides ",xterm*:Tc,*:RGB" # Enable 24-bit True Color support
set -s escape-time 10 # Eliminate ESC key delay (great for Vim/Neovim over SSH)
set -g history-limit 50000 # Increase scrollback buffer size
set -g focus-events on # Pass focus events to terminal applications
set -g display-time 3000 # Keep status messages visible longer (3s)
set -g status-interval 5 # Update status bar every 5 seconds
# --- Mouse & Clipboard Support ---
set -g mouse on # Full mouse support (scrolling, clicking, resizing)
set -s set-clipboard on # OSC 52 clipboard integration (syncs remote tmux copy to local Win/Mac clipboard)
# --- Indexing & Windows ---
set -g base-index 1 # Start window numbering at 1 (matches keyboard layout)
setw -g pane-base-index 1 # Start pane numbering at 1
set -g renumber-windows on # Automatically renumber windows when a window is closed
setw -g automatic-rename on # Auto-rename window based on active command
# --- Key Bindings & Ergonomics ---
# Reload configuration effortlessly with Prefix + r
bind r source-file ~/.tmux.conf \; display-message "Config reloaded!"
# Split panes using intuitive keys (| and -) while retaining current directory
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# Switch panes using Alt + Arrow keys without prefix (works in Windows Terminal / iTerm2)
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Vi keybindings in copy mode
setw -g mode-keys vi
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel
# Activity Monitoring
setw -g monitor-activity on
set -g visual-activity off
# --- Visual Styling & Status Bar ---
set -g status-position bottom
set -g status-style "bg=#1e1e2e,fg=#cdd6f4"
# Left status: Session name badge
set -g status-left-length 40
set -g status-left "#[bg=#89b4fa,fg=#11111b,bold] #S #[bg=#1e1e2e,fg=#89b4fa] "
# Right status: Hostname and Clock
set -g status-right-length 80
set -g status-right "#[fg=#a6adc8] #H #[fg=#6c7086]| #[fg=#cba6f7]%Y-%m-%d %H:%M #[bg=#b4bfe2,fg=#11111b,bold] #h "
# Window status tabs
setw -g window-status-format "#[fg=#6c7086]#I:#W#F"
setw -g window-status-current-format "#[fg=#a6e3a1,bold]#I:#W#F"
setw -g window-status-separator " "
# Pane borders
set -g pane-border-style "fg=#313244"
set -g pane-active-border-style "fg=#89b4fa"
# Message styling
set -g message-style "bg=#313244,fg=#cdd6f4,bold"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment