Configuration
Configuration
Updated for tmux 3.4Create ~/.tmux.conf to customize behavior, appearance, and key bindings.
Last updated: January 23, 2025
Essential Configuration
Modern, production-ready tmux.conf for 2025
bash
# ~/.tmux.conf
# ============================================
# ESSENTIAL SETTINGS
# ============================================
# Fix Vim ESC delay
set -sg escape-time 0
# Increase scrollback buffer
set -g history-limit 50000
# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1
# Enable mouse support
set -g mouse on
# Enable focus events for vim autoread
set -g focus-events on
# Set terminal with proper colors
set -g default-terminal "tmux-256color"
set -as terminal-features ",xterm-256color:RGB"
# Aggressive resize for multi-client
setw -g aggressive-resize on
# ============================================
# KEY BINDINGS
# ============================================
# Change prefix to Ctrl+a (more ergonomic)
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Reload config
bind r source-file ~/.tmux.conf \; display "Config reloaded!"
# Better pane splitting (and keep current path)
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# Vim-style pane navigation
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Vim-style pane resizing
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
# ============================================
# APPEARANCE
# ============================================
# Status bar position
set -g status-position top
# Status bar colors
set -g status-style 'bg=#13161d fg=#8b949e'
set -g status-left-length 20
set -g status-right-length 50
# Status bar content
set -g status-left '#[fg=#00e68a,bold] #S #[fg=#30363d]│ '
set -g status-right '#[fg=#30363d]│#[fg=#8b949e] %H:%M #[fg=#30363d]│#[fg=#8b949e] %d-%b-%y '
# Window status
setw -g window-status-format ' #I:#W '
setw -g window-status-current-format '#[fg=#00e68a,bold] #I:#W '
# Pane border colors
set -g pane-border-style 'fg=#30363d'
set -g pane-active-border-style 'fg=#00e68a'
# Message styling
set -g message-style 'bg=#00e68a fg=#000000 bold'
# ============================================
# COPY MODE
# ============================================
# Use vi keys
setw -g mode-keys vi
# Vi-style copy bindings
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "pbcopy" # macOS
# bind -T copy-mode-vi y send -X copy-pipe-and-cancel "xclip -selection clipboard -i" # Linux
# ============================================
# PLUGINS (via TPM)
# ============================================
# Install TPM first:
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# Plugin settings
set -g @resurrect-strategy-vim 'session'
set -g @continuum-restore 'on'
# Initialize TPM (keep at bottom)
run '~/.tmux/plugins/tpm/tpm'🎨 Status Line Customization
Personalize your status bar with session info, system stats, and custom indicators:
bash
# Format variables
#{session_name} # Current session
#{window_index} # Window number
#{window_name} # Window name
#{pane_current_path} # Current directory
#{host} # Hostname
#{?window_zoomed_flag,🔍,} # Conditional
# Shell commands
#(uptime | cut -d "," -f 3) # Load average
#(date +%H:%M) # Custom time🎹 Advanced Key Bindings
Create powerful custom bindings for your workflow:
bash
# No prefix needed (-n flag)
bind -n C-t new-window
# Repeatable binding (-r flag)
bind -r C-Up resize-pane -U
# Conditional logic
if-shell 'test -n "$SSH_CLIENT"' \
'set -g status-bg blue'🔄 Apply Changes: Either restart tmux or press
Ctrl+b : → type source-file ~/.tmux.conf → Enter. Or bind it to a key like above (Ctrl+b r)!Continue Learning
Explore more ways to enhance your tmux setup: