set-option
Short form: set
Set a session, window, or server option. Without -g, the option is set for the current session.
How set-option works
set-option, usually written set, changes tmux settings. Nearly every line in a .tmux.conf is a set command, from the prefix key to status bar colors.
Options live at four levels: server options (-s) for the whole tmux server, session options (the default), window options (-w), and pane options (-p). -g sets the global value that every session, window, or pane falls back to. tmux works out the level from the option's name for built-in options, so in practice set -g name value is enough most of the time.
-u unsets an option so it falls back to the global value, and -a appends to a string or style option instead of replacing it. For on/off options you can leave out the value to toggle it, which is handy for key bindings.
Synopsis
tmux set-option [-aFgopqsuUw] [-t target-pane] option [value]Options
| Flag | Description |
|---|---|
| -g | Set global option (affects all sessions/windows) |
| -a | Append to a string or style option |
| -u | Unset option so it falls back to the global value |
| -w | Set window option (same as setw) |
| -p | Set pane option |
| -s | Set server option |
| -o | Don't change the option if it is already set |
| -q | Don't complain about unknown or ambiguous options |
| -F | Expand formats in the value |
Examples
Enable mouse globally
tmux set -g mouse onChange prefix to Ctrl+a
tmux set -g prefix C-aStart window numbering at 1
tmux set -g base-index 1Increase scrollback buffer
tmux set -g history-limit 10000Toggle typing into every pane of the window at once. Run it again to turn it off.
tmux setw synchronize-panesIn .tmux.conf: show the time on the right of the status bar, then append the host name.
set -g status-right '%H:%M'
set -ag status-right ' #H'Default Keybinding
set-option has no default key. Run it from a shell as tmux set-option, type it at the command prompt (Ctrl+b then :), or give it a key with bind-key.
Common Mistakes
- Without -g, the setting only applies to one session or window, so new ones won't get it. In .tmux.conf, almost every set should use -g.
- Some options only affect panes or windows created after the change, such as history-limit and default-terminal. Open a new pane to see the effect.
- A typo gives 'invalid option: mous'. Check names with tmux show-options -g, or look them up in man tmux.
Pro Tips
- •Use -g for options that should apply to all sessions
- •Put these in your .tmux.conf for persistence
Related Commands
show-optionsset-window-option