# tmux choose-buffer

Source: https://libtmux.org/en/tmux/3.2a/manual/choose-buffer/

> Put a pane into buffer mode, where a buffer may be chosen interactively from a list.

Put a pane into buffer mode, where a buffer may be chosen interactively from a list.

## Syntax

```tmux-usage
tmux choose-buffer [-NrZ] [-F format] [-f filter] [-K key-format] [-O sort-order] [-t target-pane] [template]
```

## Behavior

Put a pane into buffer mode, where a buffer may be chosen interactively from a list. Each buffer is shown on one line. A shortcut key is shown on the left in brackets allowing for immediate choice, or the list may be navigated and an item chosen or otherwise manipulated using the keys below. `-Z` zooms the pane. The following keys may be used in buffer mode:

|                                                                  |                                                                          |
| ---------------------------------------------------------------- | ------------------------------------------------------------------------ |
| [**Key**](https://libtmux.org/en/tmux/3.2a/manual/full/#Key~5)   | [**Function**](https://libtmux.org/en/tmux/3.2a/manual/full/#Function~6) |
| [`Enter`](https://libtmux.org/en/tmux/3.2a/manual/full/#Enter~5) | Paste selected buffer                                                    |
| [`Up`](https://libtmux.org/en/tmux/3.2a/manual/full/#Up~5)       | Select previous buffer                                                   |
| [`Down`](https://libtmux.org/en/tmux/3.2a/manual/full/#Down~5)   | Select next buffer                                                       |
| [`C-s`](https://libtmux.org/en/tmux/3.2a/manual/full/#C-s~4)     | Search by name or content                                                |
| [`n`](https://libtmux.org/en/tmux/3.2a/manual/full/#n~4)         | Repeat last search                                                       |
| [`t`](https://libtmux.org/en/tmux/3.2a/manual/full/#t~4)         | Toggle if buffer is tagged                                               |
| [`T`](https://libtmux.org/en/tmux/3.2a/manual/full/#T~5)         | Tag no buffers                                                           |
| [`C-t`](https://libtmux.org/en/tmux/3.2a/manual/full/#C-t~4)     | Tag all buffers                                                          |
| [`p`](https://libtmux.org/en/tmux/3.2a/manual/full/#p)           | Paste selected buffer                                                    |
| [`P`](https://libtmux.org/en/tmux/3.2a/manual/full/#P~2)         | Paste tagged buffers                                                     |
| [`d`](https://libtmux.org/en/tmux/3.2a/manual/full/#d~3)         | Delete selected buffer                                                   |
| [`D`](https://libtmux.org/en/tmux/3.2a/manual/full/#D~4)         | Delete tagged buffers                                                    |
| [`e`](https://libtmux.org/en/tmux/3.2a/manual/full/#e)           | Open the buffer in an editor                                             |
| [`f`](https://libtmux.org/en/tmux/3.2a/manual/full/#f~5)         | Enter a format to filter items                                           |
| [`O`](https://libtmux.org/en/tmux/3.2a/manual/full/#O~3)         | Change sort field                                                        |
| [`r`](https://libtmux.org/en/tmux/3.2a/manual/full/#r~3)         | Reverse sort order                                                       |
| [`v`](https://libtmux.org/en/tmux/3.2a/manual/full/#v~5)         | Toggle preview                                                           |
| [`q`](https://libtmux.org/en/tmux/3.2a/manual/full/#q~5)         | Exit mode                                                                |

After a buffer is chosen, ‘`%%`’ is replaced by the buffer name in `template` and the result executed as a command. If `template` is not given, "paste-buffer -b '%%'" is used.

`-O` specifies the initial sort field: one of ‘`time`’, ‘`name`’ or ‘`size`’. `-r` reverses the sort order. `-f` specifies an initial filter: the filter is a format - if it evaluates to zero, the item in the list is not shown, otherwise it is shown. If a filter would lead to an empty list, it is ignored. `-F` specifies the format for each item in the list and `-K` a format for each shortcut key; both are evaluated once for each line. `-N` starts without the preview. This command works only if at least one client is attached.

## C implementation

Internal declarations in tmux 3.2a:

* [`cmd_choose_buffer_entry`](https://libtmux.org/en/tmux/3.2a/reference/c-variable-cmd_choose_buffer_entry/)
* [`cmd_choose_tree_exec`](https://libtmux.org/en/tmux/3.2a/reference/c-function-cmd-choose-tree-c-cmd_choose_tree_exec/)

## Use from a library

Each API describes its own defaults, errors and execution model.

* [Python](https://libtmux.org/en/py/latest/reference/libtmux-pane-choose_buffer/)
* [TypeScript](https://libtmux.org/en/ts/latest/reference/pane-pane-choosebuffer/)
* [Go](https://libtmux.org/en/go/latest/reference/tmux-pane-choosebuffer/)
* [C#](https://libtmux.org/en/csharp/latest/reference/libtmux-pane-choosebufferasync/)

tmux sources and license

Syntax comes from `tmux 3.2a list-commands`. See the [global options](https://libtmux.org/en/tmux/3.2a/manual/full/#DESCRIPTION) for sockets and configuration, and [command syntax and targets](https://libtmux.org/en/tmux/3.2a/manual/full/#COMMANDS).

Behavior is taken from the [tmux 3.2a manual](https://github.com/tmux/tmux/blob/85893888497c5077979bc7557fb970ee5e3d13d9/tmux.1).

[Command declaration](https://github.com/tmux/tmux/blob/85893888497c5077979bc7557fb970ee5e3d13d9/cmd-choose-tree.c#L58)

```
Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
```
