Skip to main content

Config Deep Dive

File System Layout

PathPurpose
~/.tmux.confSymlink → canonical config (do not edit directly)
~/github/common-config/tmux/tmux-config-symlink/.tmux.confCanonical config — edit this file
~/.tmux/plugins/tpm/Plugin manager
~/.tmux/plugins/tmux-resurrect/Session save/restore
~/.tmux/plugins/tmux-continuum/Auto-save
~/.local/share/tmux/resurrect/Session backup files (300+ snapshots)
~/github/common-config/tmux/gc-sg-m16/continuum/<date>/Host-specific backup archive by date
~/github/common-config/tmux/default config/tmux 3.4 defaults snapshot

Config Chain

~/.tmux.conf → symlink to
~/github/common-config/tmux/tmux-config-symlink/.tmux.conf

Edit the canonical file, not the symlink. Reload with tmux source-file ~/.tmux.conf.

Backup Chain

tmux-resurrect saves to:
~/.local/share/tmux/resurrect/tmux_resurrect_<timestamp>.txt

tmux-continuum auto-saves every 15 minutes.
Post-save hook copies to:
~/github/common-config/tmux/gc-sg-m16/continuum/<date>/
(60-day retention, auto-cleanup)

Default vs This Server

Prefix

DefaultThis Server
Prefix keyCtrl+bCtrl+Space
Send literal prefixCtrl+b Ctrl+bCtrl+Space Ctrl+Space

Settings Changed

SettingDefaultThis Server
default-command''bash -c 'cd ~ && exec bash'
set-clipboardexternalon
extended-keysoffon
status-stylebg=green,fg=blackbg=colour17,fg=white
status-left-length1040
default-shell/bin/bash/bin/bash
history-limit20002000 (default)

Custom Bindings Added

Mnemonic Splits

DefaultModificationAction
Ctrl+b %`Ctrl+Space`
Ctrl+b "Ctrl+Space -Split vertically (horizontal dash → top/bottom)

Prefix-Free Navigation

DefaultModificationAction
Ctrl+b arrowsAlt+arrowsNavigate panes (no prefix)
Ctrl+b arrowsAlt+h/j/k/lNavigate panes vim-style (no prefix)
Ctrl+b zAlt+zToggle zoom (no prefix)
Ctrl+b n/pAlt+PageDown/UpNext/previous window (no prefix)
Ctrl+b 1/2/3Alt+1/2/3Jump to window 1/2/3 (no prefix)
Ctrl+b (/ )Alt+Home/EndPrevious/next session (no prefix)
TableKeyThenAction
Swap panePrefix SLeft/Right/Up/Down or h/j/k/lSwap with pane in direction
RenamePrefix ew / s / pRename window / session / pane title

Custom Quick Actions

DefaultModificationAction
Ctrl+b cCtrl+Space WNew window
Ctrl+b &Ctrl+Space XKill current window (prompted)
Ctrl+Space NNew named session
Ctrl+Space kKill current session (prompted)
Ctrl+b sCtrl+Space sSession chooser
Ctrl+b wCtrl+Space wWindow/pane tree
Ctrl+b LCtrl+Space LLast session
Ctrl+b mCtrl+Space aToggle mouse

Defaults Removed

DefaultReason
Prefix OUnbound
Prefix AUnbound (replaced by mouse toggle Prefix a)
Prefix SUnbound (replaced by swap table)
Prefix H/J/K/LUnbound

Annotated ~/.tmux.conf

Local Overrides

set -g default-command "bash -c 'cd ~ && exec bash'"
set -g set-clipboard on
set -g extended-keys on
set-option -g status-style bg=colour17,fg=white
set -g status-left-length 40

Starts every new pane in the home directory. Enables clipboard and extended keys. Dark status bar matching the terminal theme.

Prefix Change

unbind C-b
set -g prefix C-Space
bind C-Space send-prefix

Changes the prefix from Ctrl+b to Ctrl+Space. The send-prefix binding lets you send Ctrl+Space to nested tmux sessions by pressing it twice.

Mnemonic Split Bindings

bind - split-window -v
bind '|' split-window -h

- looks like a horizontal line (top/bottom split). | looks like a vertical line (left/right split).

Prefix-Free Navigation

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
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R
bind -n M-z resize-pane -Z

All Alt+ shortcuts work without the prefix key. Arrow keys and vim-style hjkl both work for pane navigation.

Window and Session Shortcuts

bind -n M-PageUp previous-window
bind -n M-PageDown next-window
bind -n M-1 select-window -t 1
bind -n M-2 select-window -t 2
bind -n M-3 select-window -t 3
bind -n M-Home switch-client -p
bind -n M-End switch-client -n

Prefix-free window switching with Alt+PageUp/Down and session switching with Alt+Home/End.

Swap Pane Table

bind S switch-client -T opencode-swap
bind -T opencode-swap Left swap-pane -s '{left-of}'
bind -T opencode-swap Right swap-pane -s '{right-of}'
bind -T opencode-swap Up swap-pane -s '{up-of}'
bind -T opencode-swap Down swap-pane -s '{down-of}'
bind -T opencode-swap h swap-pane -s '{left-of}'
bind -T opencode-swap j swap-pane -s '{down-of}'
bind -T opencode-swap k swap-pane -s '{up-of}'
bind -T opencode-swap l swap-pane -s '{right-of}'

Press Prefix S (then release), then use arrows or hjkl to swap the current pane with the one in that direction.

Rename Table

bind e switch-client -T opencode-rename
bind -T opencode-rename w command-prompt -I "#W" { rename-window "%%" }
bind -T opencode-rename s command-prompt -I "#S" { rename-session "%%" }
bind -T opencode-rename p command-prompt -I "#{pane_title}" { select-pane -T "%%" }

Press Prefix e (then release), then w to rename window, s to rename session, or p to set pane title.

Quick Actions

bind a if-shell -F '#{mouse}' 'set -g mouse off' 'set -g mouse on'
bind N command-prompt -p "new session name" { new-session -s "%%" }
bind W new-window
bind L switch-client -l
bind X confirm-before -p "kill-window #W? (y/n)" kill-window
bind k confirm-before -p "kill-session #S? (y/n)" kill-session

Toggle mouse mode with Prefix a. Create new named sessions with Prefix N. Prefix X kills the current window with a safety prompt, Prefix k kills the current session with a safety prompt.

Copy Mode Additions

bind -T copy-mode S-Left send-keys -X begin-selection \; send-keys -X cursor-left
bind -T copy-mode S-Right send-keys -X begin-selection \; send-keys -X cursor-right
bind -T copy-mode C-S-Left send-keys -X begin-selection \; send-keys -X previous-word
bind -T copy-mode C-S-Right send-keys -X begin-selection \; send-keys -X next-word-end
bind -T copy-mode h send-keys -X begin-selection \; send-keys -X cursor-left
bind -T copy-mode j send-keys -X begin-selection \; send-keys -X cursor-down
bind -T copy-mode k send-keys -X begin-selection \; send-keys -X cursor-up
bind -T copy-mode l send-keys -X begin-selection \; send-keys -X cursor-right
bind -T copy-mode C-a send-keys -X history-top \; send-keys -X begin-selection \; send-keys -X history-bottom \; send-keys -X copy-pipe-and-cancel

Shift+arrow starts a character selection. Ctrl+Shift+arrow extends by word. hjkl in copy mode also selects while moving. Ctrl+a selects and copies all content (select all).

Plugin Block

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
set -g @resurrect-dir "$HOME/.local/share/tmux/resurrect"
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-processes 'yazi opencode ssh btop visidata python3'

Three plugins active: TPM for management, resurrect for manual save/restore, continuum for auto-save.

Backup Hook

set -g @resurrect-hook-post-save-layout '
mkdir -p ~/github/common-config/tmux/gc-sg-m16/continuum/$(date +%F) &&
cp "$1" ~/github/common-config/tmux/gc-sg-m16/continuum/$(date +%F)/tmux-resurrect-$(hostname)-$(basename "$1") &&
find ~/github/common-config/tmux/gc-sg-m16/continuum/ -mindepth 2 -type f -mtime +60 -delete &&
find ~/github/common-config/tmux/gc-sg-m16/continuum/ -mindepth 1 -type d -empty -delete'

Every save triggers a copy to a dated directory under common-config for git tracking. Backups older than 60 days are cleaned up automatically.

Final Bindings

run '~/.tmux/plugins/tpm/tpm'
bind w choose-tree -Zw

TPM must be the last line. Prefix w opens the searchable session/window/pane tree.