Skip to main content

Understanding Copy Mode

Copy mode allows you to navigate through a pane’s history, search for text, and copy content to paste buffers. It’s similar to a pager like less or a text editor’s visual mode.
Copy mode provides access to the scrollback history, which by default stores 2000 lines. You can adjust this with the history-limit option.

Entering Copy Mode

Basic Entry

From the command line:

Exit Copy Mode

Press q (vi mode) or Escape (emacs mode) to exit copy mode.

Key Binding Modes

tmux supports two key binding sets for copy mode: vi and emacs. Set your preference with:

Vi Key Bindings

Emacs Key Bindings

Searching in Copy Mode

Vi Mode Searching

Emacs Mode Searching

Search Commands

From the tmux command prompt or key bindings:

Advanced Searching

Searches use regular expressions by default. For literal string matching, use the -text variants.

Selecting and Copying Text

Vi Mode Selection

Emacs Mode Selection

Copy Commands

Explicit copy commands for use with send-keys -X:

Copy Flags

Selection Modes

Copy mode supports different selection modes:

Character Selection (Default)

Select character by character.

Line Selection

Select entire lines at a time.

Rectangle Selection

Select a rectangular block of text.

Word Selection

Select word under cursor.

Jumping in Copy Mode

Quickly move within a line:

Vi Mode Jumps

Example:

Jump Commands

Marks and Position

Setting Marks

Position Indicator

The position indicator shows:
  • Current cursor position
  • Total lines in history
  • Search match count (when searching)

Advanced Copy Mode Features

Scrolling Modes

History Navigation

Prompt navigation requires your shell to emit OSC 133 escape sequences. Supported by some shells with proper configuration.

Matching Brackets

Paragraph Navigation

Paste Buffers

Copied text is stored in paste buffers.

Viewing Buffers

Pasting Buffers

Managing Buffers

Mouse Support in Copy Mode

When mouse mode is enabled:
Mouse actions in copy mode:
  • Click and drag - Select text
  • Double-click - Select word
  • Triple-click - Select line
  • MouseDrag1 - Begin selection
  • MouseDragEnd1 - Copy selection and exit
  • WheelUp/Down - Scroll history

Mouse Copy Configuration

Customizing Copy Mode

Custom Key Bindings

Copy to System Clipboard

Word Separators

Customize what characters are considered word boundaries:

Copy Mode Commands Reference

All Copy Mode Commands

Complete list of commands for send-keys -X:

Practical Examples

Quick Clipboard Integration

Search and Copy Workflow

Copy Command Output

Incremental Search Setup