If you're thinking about bookmarking or linking this page, maybe go for the main config instead. I try, but down here in the details it's a bit of a mess. Individual files get renamed. Lots.

My tmux config


Figuring out terminal support

Always a bit of struggle with me for some reason.

# set -g default-terminal "tmux-256color"

# The terminal supports true color
set-option -g default-terminal "tmux-256color"
#set-option -ga terminal-overrides ',*256*:RGB'
set-option -sa terminal-overrides ",alacritty:RGB"
set-option -sa terminal-overrides ",tmux-256color:RGB"

Clipboard and system integration

# See /opt/local/share/doc/tmux-pasteboard/Usage.md
#if-shell 'test "$(uname -s)" = Darwin' 'set-option -g default-command "exec reattach-to-user-namespace -l zsh"'
set -s escape-time 1
set -g mouse on

if-shell "uname | grep -q Darwin" {
  bind-key -T copy-mode-vi 'y' \
    send -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'
  bind-key -T copy-mode-vi Enter \
    send -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'
} {
  bind-key -T copy-mode-vi 'y' \
    send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
  bind-key -T copy-mode-vi Enter \
    send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'

set-option -g focus-events on


# via https://github.com/gpakosz/.tmux/blob/master/.tmux.conf
set -g base-index 1          # window numbering
setw -g pane-base-index 1    # pane numbering
set -g renumber-windows on   # renumber when a window closed?
setw -g automatic-rename on # rename window to reflect current program?
set -g set-titles on         # set terminal title

set -g monitor-activity on
set -g visual-activity on

Key bindings

set-window-option -g xterm-keys on
set-window-option -g mode-keys vi

bind c new-window -c "#{pane_current_path}"
bind C new-window -- nu
bind r source-file ~/.tmux.conf \; display "Reloaded!"

bind \\ split-window -h -c "#{pane_current_path}"
unbind %

bind - split-window -v -c "#{pane_current_path}"
unbind '"'

bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

Status bar

set -g status on
set -g status-interval 10    # redraw status line after n seconds
set-window-option -g status-position top

Widgets that go in the status bar.

# See also: https://github.com/samoshkin/tmux-config/blob/master/tmux/tmux.conf
wg_date="#[$color_secondary]%Y-%m-%d %H:%M%z#[default]"
#set -g status-right "#{prefix-highlight} #(task-counts) $wg_date"
set -g status-right "#{prefix-highlight} $wg_date"


Using named colors so that hypothetically tmux responds to my terminal theme

Default bar color

set-option -g status-style "bg=#1b1c36, fg=#ecf0c1"

Active pane

set -g pane-active-border-style "fg=#fccc96"

Inactive pane

set -g pane-border-style "fg=#686f9a"

Active window

set-option -g window-status-current-style "bg=#686f9a, fg=#ffffff"


set-option -g message-style "bg=#686f9a, fg=#ecf0c1"
set-option -g message-command-style "bg=#686f9a, fg=#ecf0c1"

When commands are run

set -g message-style "fg=#0f11b0, bg=#686f9a"