Chapter 4: Working With Text and Buffers

Chapter Overview

Topics covered:

  • Scrolling through output (copy mode)

  • Selecting and copying text

  • Working with multiple paste buffers

  • System clipboard integration

Key Concepts

Copy Mode

# Enter copy mode
<prefix> [

# Exit copy mode
q  or  Escape

Vi vs Emacs Mode

# Set vi mode in config
set-window-option -g mode-keys vi

Selection in Vi Mode

# Start selection
Space  (or v)

# Copy selection
Enter  (or y)

# Rectangle selection
Ctrl+v

Paste Buffers

# Paste most recent
<prefix> ]

# Choose buffer to paste
<prefix> =

# List buffers
tmux list-buffers

Exercises

Exercise 4.1: Copy Mode Navigation

  1. Enter copy mode

  2. Navigate using vi keys (h,j,k,l)

  3. Jump to top/bottom of buffer

  4. Search for text

  5. Exit copy mode

# Key sequence practiced:

Exercise 4.2: Text Selection and Copy

  1. Run a command with output (e.g., ls -la)

  2. Enter copy mode

  3. Select multiple lines

  4. Copy selection

  5. Paste in another pane

# Key sequence practiced:

Exercise 4.3: System Clipboard Integration

Configure tmux to work with system clipboard:

# For Linux (X11)
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -selection clipboard"

# For Linux (Wayland)
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "wl-copy"

# Your config:

Exercise 4.4: Multiple Buffers

  1. Copy different text snippets to separate buffers

  2. List all buffers

  3. Paste from a specific buffer

  4. Delete a buffer

# Commands used:

Notes

Write your observations, insights, and questions here as you read.

Config Ideas

Copy/paste settings for quantum config:

# Ideas for dots-quantum/tmux/.config/tmux/tmux.conf

# Vi mode
set-window-option -g mode-keys vi

# Clipboard integration (Wayland - your setup)

Chapter Completed

  • Read chapter

  • Mastered copy mode navigation

  • Configured clipboard integration

  • Practiced buffer management

Date completed: _