# tmux_buffer:rename/3

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

```
rename(Server, Old, New)
-spec rename(tmux_server:t(), binary(), binary()) ->
                {ok, tmux_operation:completed()} |
                {error, map()}.
```

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.

## Parameters

- `Server` (`tmux_server:t()`)
- `Old` (`binary()`)
- `New` (`binary()`)

## tmux command

The tmux commands behind `rename/3`.

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

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_set_buffer_entry`](/en/tmux/latest/reference/c-variable-cmd_set_buffer_entry/) (attribute)
- [`cmd_set_buffer_exec`](/en/tmux/latest/reference/c-function-cmd-set-buffer-c-cmd_set_buffer_exec/) (function)
