|
| 1 | +logseq-entity:: [[Logseq/Entity/Question]] |
| 2 | +see-also:: [[tmux/Option/mode-keys]], [[tmux/Option/status-keys]] |
| 3 | + |
| 4 | +- # How can I query the current value of a [[tmux]] option? |
| 5 | + - ## [[AI Answer]] |
| 6 | + - **Short answer:** Use `tmux show-options` for session options and `tmux show-window-options` for window options; add `-g` to query the global (default) value. |
| 7 | + - ### Option types and their query commands |
| 8 | + - [[tmux]] options fall into two main scopes: |
| 9 | + - | Scope | Command | Example option | |
| 10 | + |-------|---------|----------------| |
| 11 | + | Session | `show-options` (alias `show`) | `status-keys` | |
| 12 | + | Window | `show-window-options` (alias `showw`) | `mode-keys` | |
| 13 | + - ### Query a specific option |
| 14 | + - ~~~sh |
| 15 | + # Session option — controls status-bar / command-prompt key mode |
| 16 | + tmux show-options -g status-keys |
| 17 | + # → status-keys vi |
| 18 | + |
| 19 | + # Window option — controls copy-mode key bindings |
| 20 | + tmux show-window-options -g mode-keys |
| 21 | + # → mode-keys vi |
| 22 | + ~~~ |
| 23 | + - The `-g` flag reads the **global** (config-level) default. Omit `-g` inside a tmux session to read the current session or window value, which may differ if overridden at runtime. |
| 24 | + - ### Show only the value (no key name) |
| 25 | + - ~~~sh |
| 26 | + tmux show-options -gv status-keys |
| 27 | + # → vi |
| 28 | + ~~~ |
| 29 | + - ### Query from the tmux command prompt |
| 30 | + - Press `Prefix + :` to open the tmux command prompt and enter: |
| 31 | + - ~~~ |
| 32 | + show-options -g status-keys |
| 33 | + show-window-options -g mode-keys |
| 34 | + ~~~ |
| 35 | + - ### Show all options at once |
| 36 | + - ~~~sh |
| 37 | + tmux show-options -g # all global session options |
| 38 | + tmux show-window-options -g # all global window options |
| 39 | + ~~~ |
| 40 | + - ### Sources |
| 41 | + - [tmux(1) man page — show-options](https://man.openbsd.org/tmux.1) |
0 commit comments