Site Tools


wiki:tmux-configuration

Tmux Configuration

Configuration happens in ~/.tmux.conf. Tmux reads this file on startup. Reload it anytime without restarting tmux by running tmux source-file ~/.tmux.conf or pressing Ctrl+B :source-file ~/.tmux.conf in command mode.

Common settings

Change the prefix key from Ctrl+B to Ctrl+A:

set-option -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix

Enable 256 color terminal:

set-option -g default-terminal "screen-256color"

Enable mouse support:

set-option -g mouse on

Customize status bar colors:

set-option -g status-bg black
set-option -g status-fg white
set-option -g status-left " #S "
set-option -g status-right "%H:%M %d-%b-%y "

Use vi keys in copy mode:

set-window-option -g mode-keys vi

Start window and pane numbering at 1 instead of 0:

set-option -g base-index 1
set-window-option -g pane-base-index 1

Automatic window renaming:

set-window-option -g automatic-rename on

Custom key bindings

Bind Ctrl+L to clear the screen without needing the prefix:

bind-key -n C-l send-keys -R 'clear' Enter

Bind prefix v to split horizontally (intuitive for vim users):

bind-key v split-window -h

Bind prefix s to split vertically:

bind-key s split-window -v

Use the -n flag for bindings that don't require the prefix. Use -r to make a binding repeatable (hold down the prefix key and keep pressing).

Reload configuration

After editing ~/.tmux.conf, reload it:

$ tmux source-file ~/.tmux.conf

Or from within a session:

Ctrl+B :source-file ~/.tmux.conf Enter

Option names can be abbreviated: set-optionset, set-window-optionsetw, bind-keybind.

wiki/tmux-configuration.md · Last modified: by 127.0.0.1