tmux configuration allows you to customize sessions, windows, panes, key bindings, and visual appearance. Configuration is loaded from files at startup and can be modified at runtime.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tmux/tmux/llms.txt
Use this file to discover all available pages before exploring further.
Configuration Files
tmux searches for and loads configuration files in the following order:- System-wide configuration:
/etc/tmux.conf - User configuration:
~/.tmux.confor$XDG_CONFIG_HOME/tmux/tmux.conf - Command-line specified: Files passed with
-fflag
load_cfg() function in cfg.c:108. If a file is not found and the -q (quiet) flag is not set, tmux will report an error.
If you have both
~/.tmux.conf and $XDG_CONFIG_HOME/tmux/tmux.conf, tmux will use ~/.tmux.conf as it’s checked first.Configuration Syntax
Configuration files use tmux’s command syntax. Each line contains a command that would normally be entered at the tmux command prompt.Basic Commands
Comments
Lines beginning with# are comments:
Conditional Configuration
tmux supports conditional blocks using%if, %elif, %else, and %endif:
Loading Configuration
Configuration files are processed by thecmd_parse_from_file() function. The loading process:
- Parsing: Each line is parsed according to tmux command syntax
- Validation: Commands are validated for correct syntax and arguments
- Execution: Valid commands are added to a queue and executed
- Error Handling: Parse errors are collected and displayed after loading
Loading at Startup
Thestart_cfg() function (cfg.c:64-93) manages configuration loading at startup:
- Runs in the global command queue with no client attached
- Blocks the initial client until configuration completes
- Shows any errors or warnings after loading
Runtime Configuration
You can load additional configuration files while tmux is running:Example Configuration
Here’s an example from example_tmux.conf showing common configuration patterns:Configuration Errors
When configuration files contain errors, tmux collects them viacfg_add_cause() (cfg.c:206-219) and displays them:
- Control mode clients: Receive errors via
%config-errormessages - Normal clients: Errors are shown in a view mode window
- No attached sessions: Errors are queued until a session is attached
Loading Order and Precedence
- Built-in defaults: tmux has default values for all options
- System configuration:
/etc/tmux.conf(if it exists) - User configuration:
~/.tmux.confor XDG config - Command-line options: Options set via
-fflag - Runtime commands: Commands executed in tmux prompt or via
source-file
set -g prefix C-b in your user config will override any prefix setting from the system config.
Configuration Best Practices
Reloading Configuration
To reload your configuration file without restarting tmux:prefix + r.
Some changes (like
default-terminal) only apply to new sessions or windows. You may need to restart tmux or create new windows to see these changes take effect.