# tmux_command:to_config/1

- **Package:** libtmux_erlang
- **Language:** Erlang
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-erlang/blob/d1b6308440cf9eb8f6647e7ae434bce60e849368/apps/libtmux_erlang/src/tmux_command.erl#L340
- **Page:** https://libtmux.org/en/erlang/latest/reference/tmux_command-to_config-1/

```
to_config/1
-spec to_config(t() | [t(), ...]) ->
                   {ok, binary()} | {error, map()}.
```

Render validated commands as native configuration text, without I/O. Accepts one command, a `sequence/1` value, or a nonempty flat list of at most 256 commands. Returns an ASCII binary of at most 32 KiB, without a final newline. Validation uses `validate/1`; escaping growth, command count and aggregate size can return `command_limit`. Lists use native command separators between independently quoted commands. Rendering does not execute them or provide atomic execution or rollback. The text carries no origin token; executing serialized configuration requires the caller to choose and validate its destination explicitly.

Each argument is doublequoted. Quote, backslash, dollar, tilde, control and
non-ASCII bytes use three-digit octal escapes. Empty arguments, semicolons,
newlines and non-UTF-8 byte values remain argument data. The lexer does not
expand their variables or tilde prefixes, strip newline indentation, or
interpret them as directives, comments or additional commands.

Protection covers one lexer pass. Native command-string arguments, including
[`bind-key`](/en/tmux/latest/manual/bind-key/) and [`set-hook`](/en/tmux/latest/manual/set-hook/) values, can be parsed again by the receiving command.
Render each inner command string separately for its own parse boundary.

This is tmux configuration syntax, separate from `argv/1` executable arguments
and shell quoting. Native commands still interpret their values and expand
formats as usual; `literal_format/2` handles that separate boundary when
literal format values are required. Load the text explicitly with
`source_file/2`, or store it through a native command that accepts configuration
text. The [configuration guide](configuration.md) uses this renderer with
explicit execution and completion signals.

## Parameters

- `Argument1` (`t() | [t(), ...]`)

## Guides

Pages that discuss `to_config/1`.

- [Native API documentation](/en/erlang/latest/guides/api-documentation/)
- [Build commands before running them](/en/erlang/latest/guides/commands/)
- [Apply configuration and await its completion signal](/en/erlang/latest/guides/configuration/)
- [Install application keybindings](/en/erlang/latest/guides/keys/)
