# tmux_buffer

- **Package:** libtmux_erlang
- **Language:** Erlang
- **Kind:** module
- **Source:** https://github.com/libtmux/libtmux-erlang/blob/d1b6308440cf9eb8f6647e7ae434bce60e849368/apps/libtmux_erlang/src/tmux_buffer.erl#L1
- **Page:** https://libtmux.org/en/erlang/latest/reference/tmux_buffer/

Load, inspect and paste tmux byte buffers through an explicit endpoint.

Use `load/3` for binary payloads, including NUL bytes, and `show/2` to read
them back without terminal escaping or an added newline. `list/1` returns
captured metadata in tmux's newest-first order; it never loads payloads.
`paste/3` sends a named buffer to a registered pane. Direct input is available
through `tmux_pane:send_text/2`.

Names are NUL-free binaries, distinct from payload bytes. New names retain
tmux's storage rules: 3.7+ cleans names and can reject control bytes or escape
backslashes. Use observed names from `list/1` for subsequent calls. Empty load
input is tmux's no-op; it neither creates nor clears a buffer. `delete/2`
removes a buffer explicitly. Names have no persistent object identity, and
concurrent commands can replace a buffer between calls.

All operations except `capabilities/1` perform explicit I/O. They use the
one-shot transport and preserve operational errors and ownership checks.
The [buffer guide](buffers.md) shows a complete byte round trip.

## Members

### Collections and queries

- [`list/1`](/en/erlang/latest/reference/tmux_buffer-list-1/) (function): Capture metadata in tmux's newest-first insertion order. Renaming preserves position; replacing data through `load/3` inserts a new buffer. Length frames preserve names containing delimiters, newlines or invalid UTF-8 on releases that permit them. Returns an ordinary list, bounded to 4096 rows and 1 MiB of encoded output. No payloads, hidden refresh or atomic snapshot is provided.

### Common operations

- [`paste/3`](/en/erlang/latest/reference/tmux_buffer-paste-3/) (function): Send a named buffer or latest to a registered pane. Defaults preserve payload bytes: LF separators and unsanitized input. On tmux 3.7+, raw paste uses -S; sanitize=true selects its safe print encoding. Earlier releases reject that request with unsupported_capability before dispatch.
- [`show/2`](/en/erlang/latest/reference/tmux_buffer-show-2/) (function): Read exact payload bytes with default bounds. See `show/3` for limits.
- [`delete/2`](/en/erlang/latest/reference/tmux_buffer-delete-2/) (function): Delete a named buffer or latest. Missing buffers return buffer_not_found. This performs I/O and affects the server-wide buffer store.
- [`load/3`](/en/erlang/latest/reference/tmux_buffer-load-3/) (function): Load binary bytes under a name, or create an automatic buffer. Input may contain NUL. Empty input succeeds without changing the buffer store, including an existing name. The command payload, including argv and stdin, must fit the endpoint's 256 KiB admission limit. See `tmux_server:command/3`.
- [`capabilities/1`](/en/erlang/latest/reference/tmux_buffer-capabilities-1/) (function): Describe version differences without I/O. This does not qualify an untested release. `paste/3` uses paste_sanitize to gate sanitization and render raw paste.

### Other members

- [`capabilities/0`](/en/erlang/latest/reference/t-tmux_buffer-capabilities-0/) (typealias): Source-defined buffer behavior for a parsed daemon version.
- [`info/0`](/en/erlang/latest/reference/t-tmux_buffer-info-0/) (typealias): Captured name, payload byte count and Unix creation time; not a live handle.
- [`paste_options/0`](/en/erlang/latest/reference/t-tmux_buffer-paste_options-0/) (typealias): Paste controls. separator defaults to LF; delete and bracketed default to false. sanitize defaults to false, preserving bytes. Explicit sanitization requires tmux 3.7+. Bracketing occurs only when the pane enables bracketed paste.
- [`read_options/0`](/en/erlang/latest/reference/t-tmux_buffer-read_options-0/) (typealias): Read bounds: max_bytes defaults to 1 MiB; deadline_ms defaults to 2500.
- [`rename/3`](/en/erlang/latest/reference/tmux_buffer-rename-3/) (function): Rename one explicit name. tmux 3.3 refuses an occupied destination; 3.4+ replaces it. This is native collision behavior, not an atomic absence check. Identical input names return same_buffer_name before I/O, avoiding unsafe legacy tmux paths. New names retain native cleaning rules; see `list/1` for stored names. The same observed 3.3/3.3a missing-name preflight and race as `delete/2` apply.
- [`show/3`](/en/erlang/latest/reference/tmux_buffer-show-3/) (function): Read exact payload bytes from an unattached one-shot client. No print decoding or newline removal applies. max_bytes is 0 through 1 MiB; exceeding it returns output_limit with partial command evidence, never a successful truncated value. deadline_ms is 1 through 600000. Missing buffers return buffer_not_found.
- [`target/0`](/en/erlang/latest/reference/t-tmux_buffer-target-0/) (typealias): A stored buffer name, or latest to let tmux select its newest buffer.

## Guides

Pages that discuss `tmux_buffer`.

- [Native API documentation](/en/erlang/latest/guides/api-documentation/)
