# Libtmux_unix.Client.set_option

- **Module:** Libtmux_unix
- **Package:** libtmux-unix
- **Language:** OCaml
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-ocaml/blob/205dfda49742592b479247049d186956e4a4cfe9/unix/libtmux_unix.mli#L444
- **Public owner:** Libtmux_unix
- **Page:** https://libtmux.org/en/ocaml/latest/reference/libtmux_unix-client-set_option/

```
val set_option :
  ?cancel:Cancellation.t ->
  ?index:int ->
  ?append:bool ->
  t ->
  Libtmux.Options.scope ->
  name:string -> Libtmux.Options.scalar -> (unit, Libtmux.Error.t) result
```

Validate the scope and scalar kind before admission. Array values require an index, or `append:true`. Without an index, tmux splits appended text using the option's separator and fills the lowest unused indexes. Text is literal; tmux format expansion is disabled. Hooks use a separate operation.

## Parameters

- `cancel?` (`Cancellation.t`)
- `index?` (`int`)
- `append?` (`bool`)
- `arg1` (`t`)
- `arg2` (`Libtmux.Options.scope`)
- `name` (`string`)
- `arg3` (`Libtmux.Options.scalar`)

## 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)

## tmux options

Settings for the server, sessions, windows and panes, with their types, defaults and allowed values.

- [Options](/en/tmux/latest/catalog/options/) (option)

## In other ports

Set a server option

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Server.set_option`](/en/py/latest/reference/libtmux-server-set_option/) (method) |
| Lua | [`libtmux.Server:set_option`](/en/lua/latest/reference/libtmux-server-set_option/) (method) |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | [`server.Server.setOption`](/en/ts/latest/reference/server-server-setoption/) (method) |
| Rust | [`server.Server.set_option`](/en/rs/latest/reference/server-server-set_option/) (method) |
| Go | [`tmux.Server.SetOption`](/en/go/latest/reference/tmux-server-setoption/) (method) |
| Java | reached through `Server.options`, whose `Options` carries the write |
| C# | reached through `Server.Options`, whose `TmuxOptions` carries the write |
| C++ | [`libtmux::Server::set_server_option`](/en/cxx/latest/reference/libtmux-server-set_server_option/) (method) |
| Swift | [`Server.setOption(_:to:scope:)`](/en/swift/latest/reference/server-setoption(_-to-scope-)/) (method) |
| Perl | [`LibTmux::Server::set_option`](/en/perl/latest/reference/libtmux-server-set_option/) (method). Pass scope => 'server' and the explicit target ID where applicable; inherited and global reads are deliberate options. |

No equivalent is recorded in Ruby, PowerShell, Julia, Erlang, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.

Set a session option

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Session.set_option`](/en/py/latest/reference/libtmux-session-set_option/) (method) |
| Lua | [`libtmux.Session:set_option`](/en/lua/latest/reference/libtmux-session-set_option/) (method) |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | [`session.Session.setOption`](/en/ts/latest/reference/session-session-setoption/) (method) |
| Rust | [`session.Session.set_option`](/en/rs/latest/reference/session-session-set_option/) (method) |
| Go | [`tmux.Session.SetOption`](/en/go/latest/reference/tmux-session-setoption/) (method) |
| Java | reached through `Session.options`, whose `Options` carries the write |
| C# | reached through `Session.Options`, whose `TmuxOptions` carries the write |
| C++ | [`libtmux::Session::set_option`](/en/cxx/latest/reference/libtmux-session-set_option/) (method) |
| Swift | [`Server.setOption(_:to:scope:)`](/en/swift/latest/reference/server-setoption(_-to-scope-)/) (method) |
| Perl | [`LibTmux::Server::set_option`](/en/perl/latest/reference/libtmux-server-set_option/) (method). Pass scope => 'session' and the explicit target ID where applicable; inherited and global reads are deliberate options. |

No equivalent is recorded in Ruby, PowerShell, Julia, Erlang, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.

Set a window option

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Window.set_option`](/en/py/latest/reference/libtmux-window-set_option/) (method) |
| Lua | [`libtmux.Window:set_option`](/en/lua/latest/reference/libtmux-window-set_option/) (method) |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | [`window.Window.setOption`](/en/ts/latest/reference/window-window-setoption/) (method) |
| Rust | [`window.Window.set_option`](/en/rs/latest/reference/window-window-set_option/) (method) |
| Go | [`tmux.Window.SetOption`](/en/go/latest/reference/tmux-window-setoption/) (method) |
| Java | reached through `Window.options`, whose `Options` carries the write |
| C# | reached through `Window.Options`, whose `TmuxOptions` carries the write |
| C++ | [`libtmux::Window::set_option`](/en/cxx/latest/reference/libtmux-window-set_option/) (method) |
| Swift | [`Server.setOption(_:to:scope:)`](/en/swift/latest/reference/server-setoption(_-to-scope-)/) (method) |
| Perl | [`LibTmux::Server::set_option`](/en/perl/latest/reference/libtmux-server-set_option/) (method). Pass scope => 'window' and the explicit target ID where applicable; inherited and global reads are deliberate options. |

No equivalent is recorded in Ruby, PowerShell, Julia, Erlang, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.

Set a pane option

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Pane.set_option`](/en/py/latest/reference/libtmux-pane-set_option/) (method) |
| Lua | [`libtmux.Pane:set_option`](/en/lua/latest/reference/libtmux-pane-set_option/) (method) |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | [`pane.Pane.setOption`](/en/ts/latest/reference/pane-pane-setoption/) (method) |
| Rust | [`pane.Pane.set_option`](/en/rs/latest/reference/pane-pane-set_option/) (method) |
| Go | [`tmux.Pane.SetOption`](/en/go/latest/reference/tmux-pane-setoption/) (method) |
| Java | reached through `Pane.options`, whose `Options` carries the write |
| C# | reached through `Pane.Options`, whose `TmuxOptions` carries the write |
| C++ | [`libtmux::Pane::set_option`](/en/cxx/latest/reference/libtmux-pane-set_option/) (method) |
| Swift | [`Server.setOption(_:to:scope:)`](/en/swift/latest/reference/server-setoption(_-to-scope-)/) (method) |
| Perl | [`LibTmux::Server::set_option`](/en/perl/latest/reference/libtmux-server-set_option/) (method). Pass scope => 'pane' and the explicit target ID where applicable; inherited and global reads are deliberate options. |

No equivalent is recorded in Ruby, PowerShell, Julia, Erlang, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.
