# LibTmux.set_option

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** Julia
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/configuration.jl#L260
- **Page:** https://libtmux.org/en/julia/latest/reference/libtmux-set_option/

```
set_option(
    connection::LibTmux.ControlConnection,
    scope,
    name::AbstractString,
    value::AbstractString;
    index,
    kwargs...
)

set_option(
    server::LibTmux.Server,
    scope,
    name::AbstractString,
    value::AbstractString;
    index,
    kwargs...
)
```

## Methods

### `set_option` (overload 1)

```julia
set_option(
    connection::LibTmux.ControlConnection,
    scope,
    name::AbstractString,
    value::AbstractString;
    index,
    kwargs...
)
```

[Source](https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/control_options.jl#L241).

Set an exact option without format expansion. Unrestricted string options and string arrays preserve literal tabs/newlines. Numeric, flag, choice, colour, key, style and other validated options require printable UTF-8 values because tmux may reflect an invalid value in control diagnostics. tmux validates the remaining value rules. Scalar command options use `set_hook`'s literal grammar; an empty value stores an empty command list. Hook arrays require `set_hook`. Return `ControlResult`; cancellation does not roll back an admitted mutation.

```julia
set_option(connection::ControlConnection, scope, name, value; index=nothing, kwargs...)
```

### `set_option` (overload 2)

```julia
set_option(
    server::LibTmux.Server,
    scope,
    name::AbstractString,
    value::AbstractString;
    index,
    kwargs...
)
```

[Source](https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/configuration.jl#L268).

Pass a value to tmux without format expansion and return `CommandResult`. Scope and names follow `get_option`. tmux applies each option's value rules, including flag and numeric parsing. Without an index, its whole-array assignment rules apply. For executable command bodies use `set_hook`.

```julia
set_option(server, scope, name, value; index=nothing, kwargs...)
```

## Parameters

- `connection` (`LibTmux.ControlConnection`) (for `set_option(connection, scope, name, value, index, kwargs)`)
- `scope` (`Any`)
- `name` (`AbstractString`)
- `value` (`AbstractString`)
- `index`
  Default: `nothing`.
- `kwargs`
- `server` (`LibTmux.Server`) (for `set_option(server, scope, name, value, index, kwargs)`)
