Skip to main content

Mouse Mode and Scrolling

Tmux supports full mouse interaction — click to select panes, drag to resize, scroll the wheel to browse scrollback.

Learning Focus

Mouse mode is great for onboarding and occasional use, but key bindings are faster for daily workflows. Use both together.

Enabling Mouse Mode

~/.tmux.conf
# Enable full mouse support
set -g mouse on

Then reload: tmux source-file ~/.tmux.conf or Ctrl+b r (if you bound it).

What Mouse Mode Enables

Mouse ActionEffect
Click a paneFocus that pane
Click a window tabSwitch to that window
Drag pane borderResize pane
Scroll wheelScroll through pane output
Right-clickContext menu (copy, paste selections)

Scrolling Without Mouse Mode

Even without mouse mode, you can scroll using copy mode:

Ctrl+b [         → Enter copy/scroll mode
PgUp / PgDn → Scroll by page
↑ / ↓ → Scroll line by line
q / Enter → Exit copy mode

Or use the quick shortcut:

Ctrl+b PgUp      → Jump directly into copy mode + scroll up

Mouse Scrolling Inside Applications (vim, htop, etc.)

When mouse mode is on, scroll wheel events are sent to tmux, not the application inside the pane. To scroll inside an application (like vim), you need to configure the application to handle mouse events, or temporarily turn off mouse mode:

# toggle mouse with a shortcut
bind m set -g mouse \; display "Mouse toggled"
note

Most modern terminal emulators and CLI tools (vim, less, htop) handle mouse events correctly when tmux mouse mode is on, as long as they declare mouse support.

Copy with Mouse

When mouse mode is on, click and drag to select text. Then:

Enter              → Copy selection to tmux buffer
Ctrl+b ] → Paste the tmux buffer

Or hold Shift while dragging to use the terminal's native selection (bypasses tmux buffer).

Scrollback Buffer Configuration

The amount of scrollback history tmux keeps is configurable:

~/.tmux.conf
# Increase scrollback buffer (default is 2000 lines)
set -g history-limit 50000
tip

Set this to at least 10000 for log-heavy workflows. 50000 is a safe high value for most servers.

~/.tmux.conf
# Enable mouse
set -g mouse on

# Large scrollback buffer
set -g history-limit 50000

# Toggle mouse mode with prefix + m
bind m set -g mouse \; display "Mouse: #{mouse}"

What's Next