Site Tools


wiki:tmux-copy-mode

Table of Contents

Tmux Copy mode

Copy mode lets you select and copy text from the current pane buffer. Enter copy mode with Ctrl+B [, navigate with arrow keys or vim keys, select with Space, and copy with Enter.

Basic workflow:

Ctrl+B [            enter copy mode
j/k                 down/up (if using vi keys)
w/b                 next/previous word
f/F/t/T             jump to character
/                   search forward
?                   search backward
Space               start selection
Enter               copy selection and exit
Esc                 exit without copying

Configure copy mode to use vim keybindings by adding this to ~/.tmux.conf:

set-window-option -g mode-keys vi

Paste the buffer:

Ctrl+B ]            paste buffer

View and manipulate the paste buffer from the shell:

$ tmux show-buffer                  # view buffer contents
$ tmux paste-buffer                 # paste to current pane
$ tmux delete-buffer                # clear buffer
$ tmux list-buffers                 # list all buffers

By default, tmux maintains one paste buffer. When you copy in copy mode, the text is added to this buffer. Pasting always uses the most recent buffer. You can customize this in ~/.tmux.conf to maintain a history of buffers, but the single buffer is usually sufficient.

Copy mode is also useful for scrolling through output that has scrolled off the screen. On some terminals, you can also use the mouse to scroll and select text if mouse mode is enabled (set-option -g mouse on).

wiki/tmux-copy-mode.md · Last modified: by 127.0.0.1