43

I'm new to tmux and trying to understand it's configuration. I've started with looking at some pre-existing .tmux.conf files and whatever documentation I can find but it still leaves me wondering about the flags. I've seen the following so far:

A few examples from the ArchWiki entry on tmux

set -g prefix C-a  
set -ga terminal-overrides ",xterm-termite:Tc"
set-option -g xterm-keys on

And one line from a .tmux.conf file

set-window-option -g

What do the flags mean and are there any particular cases when one flag is preferable over another?

maxschlepzig
  • 35,645
  • 14
  • 145
  • 182
hrokr
  • 3,276
  • 3
  • 21
  • 39

1 Answers1

63

set is the alias of set-option.

set -g is used to set global options and -ga appends values to existing settings.

From Tmux's man page:

With -a, and if the option expects a string or a style, value is appended to the existing setting. For example:

   set -g status-left "foo"
   set -ag status-left "bar"

Will result in ‘foobar’. And:

   set -g status-style "bg=red"
   set -ag status-style "fg=blue"

Will result in a red background and blue foreground. Without -a, the result would be the default background and a blue foreground.

set-window-option (alias setw) is used to configure window options (allow-rename, mode-keys, synchronize-panes, etc.) and the same flag options are available.

See:

pdoherty926
  • 9,895
  • 4
  • 37
  • 68
  • 6
    Hm, the tmux 3.0a man page doesn't explain `setw` nor `set-window-option`. Also, `set-option` has a `-w` for window options, as well. – maxschlepzig Aug 30 '20 at 07:18
  • @maxschlepzig - ever figured out what happened? Are they deprecating `set-window-option`? I still don't see an entry for `set-window-option` on tmux manual. – rgin Jul 04 '23 at 07:52
  • @rgin Yes, a [2008 entry](https://github.com/tmux/tmux/blob/1a11c972aed11c1996d732f15ad16f02c668b5a0/CHANGES#L3018-L3019) in the tmux `CHANGES` files documents `setw` as an alias to `set-window-option`, a [2010 entry](https://github.com/tmux/tmux/blob/1a11c972aed11c1996d732f15ad16f02c668b5a0/CHANGES#L1968-L1969) documents `set-window-option` as a new alias to `set-option -w` and the [tmux 3.0 entry](https://github.com/tmux/tmux/blob/1a11c972aed11c1996d732f15ad16f02c668b5a0/CHANGES#L759-L760) announces the de-documentation of `set-window-option`. – maxschlepzig Jul 04 '23 at 21:03
  • @maxschlepzig - Thank you for the detailed response. It is very much appreciated. – rgin Jul 05 '23 at 15:16