Skip to content

Instantly share code, notes, and snippets.

@utarn
Created July 31, 2026 01:45
Show Gist options
  • Select an option

  • Save utarn/03f2fedd813ca6896fec9dadc62fab5b to your computer and use it in GitHub Desktop.

Select an option

Save utarn/03f2fedd813ca6896fec9dadc62fab5b to your computer and use it in GitHub Desktop.
Optimized tmux configuration for remote SSH (Windows & macOS clients)
# ==============================================================================
# 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"

πŸš€ Optimized tmux Configuration for Remote SSH (Windows & macOS)

A modern, high-performance .tmux.conf designed specifically for users connecting remotely via Windows Terminal, iTerm2, Alacritty, Kitty, Ghostty, or VS Code Terminal.


πŸ”‘ Key Features & UX Optimizations

  • OSC 52 Clipboard Integration: Copies text selected in tmux directly to your local Windows / macOS system clipboard without requiring X11 forwarding or local clip tools.
  • 24-bit True Color (RGB / Tc): Full color accuracy for modern CLI tools, Neovim, Vim, and shell prompts.
  • Low Latency (escape-time 10): Eliminates the ESC key delay in Vim/Neovim over remote SSH connections.
  • Ergonomic Window Indexing: Windows and panes start at 1 (matching keyboard top-row 1–9).
  • Auto-Renumbering: Closing a window automatically re-indexes remaining windows.
  • Alt + Arrow Navigation: Switch panes quickly using Alt + ←/β†’/↑/↓ without needing the prefix key.
  • Vi Mode Selection: Standard Vi keybindings (v for selection, y for copy).
  • Directory Preserving Splits: Prefix + | (horizontal) and Prefix + - (vertical) preserve the active directory.
  • Clean Catppuccin-inspired Status Bar: High-contrast, minimal status line displaying session name, window activity, host, and clock.

πŸ“¦ Installation

# Download directly to ~/.tmux.conf
curl -fsSL https://gist.githubusercontent.com/utarn/03f2fedd813ca6896fec9dadc62fab5b/raw/.tmux.conf -o ~/.tmux.conf

# Reload configuration in an active tmux session
tmux source-file ~/.tmux.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment