# libtmux:set-option

- **Package:** libtmux
- **Language:** Common Lisp
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-lisp/blob/c2e5fc4ed3befda21f45dfa5d5868c38fd138311/src/configuration-operations.lisp#L164
- **Public owner:** libtmux
- **Page:** https://libtmux.org/en/lisp/latest/reference/libtmux-set-option/

```
(set-option client name value &key scope target (key nil key-p) format-p append only-if-unset cancel-token timeout output-limit)
```

Set one typed tmux option and return its COMMAND-OUTCOME.
SCOPE is required and names one explicit table: :SERVER, :GLOBAL-SESSION,
:SESSION, :GLOBAL-WINDOW, :WINDOW or :PANE. Local scopes require a captured
TARGET of the matching type; global scopes reject one. NAME is resolved in the
exact live daemon catalog. Native numbers, Booleans and choices are validated
before payload dispatch. User names must match @[A-Za-z0-9_.-]+ and remain
strings. KEY addresses a registered array element. FORMAT-P treats VALUE as an
explicit tmux format; otherwise VALUE is literal and typed. APPEND is supported
for strings, keyed string-array elements and unkeyed array assignment. An
unkeyed array VALUE uses that option's native tmux list grammar; use KEY when
VALUE must remain one literal element. ONLY-IF-UNSET requests tmux -o: write
only when the option, or the selected array key, is absent from the local table.
Inherited values permit a local write; present false and empty values refuse
replacement. Refusal retains normal condition/outcome evidence through
ERROR-OUTCOME. The condition applies to this command; later commands and hooks
remain independent. Use UNSET-OPTION to remove state and SET-HOOK for registered
hooks. Never retries or acquires a replacement capture.

See also: `libtmux:error-outcome`, `libtmux:set-hook`, `libtmux:unset-option`.

## Parameters

- `client`
- `name`
- `value`
- `scope?`
- `target?`
- `key?`
- `format-p?`
- `append?`
- `only-if-unset?`
- `cancel-token?`
- `timeout?`
- `output-limit?`

## tmux command

The tmux commands behind `set-option`.

- [`set-option`](/en/tmux/latest/manual/set-option/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_set_option_entry`](/en/tmux/latest/reference/c-variable-cmd_set_option_entry/) (attribute)
- [`cmd_set_option_exec`](/en/tmux/latest/reference/c-function-cmd-set-option-c-cmd_set_option_exec/) (function)

## Guides

Pages that discuss `set-option`.

- [Explicit operations](/en/lisp/latest/guides/operations/)
