Copy and Paste Workflow
Kitty offers multiple ways to copy and paste text, from simple drag-select copy-on-select to the advanced clipboard kitten with history and buffer management.
Understand the three selection modes and the clipboard kitten. For daily use, copy-on-select + Ctrl+Shift+v paste covers 90% of needs.
Selection Modes
Kitty provides three selection modes, each with different behavior:
| Mode | Trigger | Behavior |
|---|---|---|
| Normal | Click-drag | Selects character-by-character |
| Line-by-line | Triple-click or Ctrl+Shift+Alt+click-drag | Selects full lines |
| Smart | Double-click-drag | Selects words, expands to logical units |
Smart Selection Details
Smart selection intelligently expands to the nearest logical boundary:
Double-click on: /var/log/app/error.log
^^^^^^^^^^^^^^^^^^^^^^^^
Selects the entire path
Double-click on: user@example.com
^^^^^^^^^^^^^^^^^
Selects the entire email
Double-click on: (error_code_42)
^^^^^^^^^^^^^^^
Selects entire parenthesized expression
Hold Alt while double-click-dragging for smart word selection across multiple items.
Keyboard Shortcuts for Copy/Paste
| Shortcut | Action |
|---|---|
Ctrl+Shift+c | Copy selection to clipboard |
Ctrl+Shift+v | Paste from clipboard |
Ctrl+Shift+s | Paste from primary selection (X11) |
Ctrl+Shift+o | Pass selection to program (e.g., pipe to file) |
Ctrl+Shift+Delete | Clear selection |
Ctrl+Shift+Alt+v | Paste from clipboard (alternative) |
Ctrl+Shift+c and Ctrl+Shift+v work inside kitty even when the terminal application has captured those shortcuts. They are handled at the terminal emulator level.
The Clipboard Kitten
Kitty includes a clipboard kitten — a dedicated tool for managing clipboard history and buffers:
# Open clipboard history viewer
kitty +kitten clipboard
# Show clipboard contents
kitty +kitten clipboard --show
# Clear clipboard history
kitty +kitten clipboard --clear
The clipboard kitten stores a history of copied items. Launch it to browse, search, and re-paste previous selections:
┌─────────────────────────────────────────┐
│ Clipboard History │
│ │
│ [1] /var/log/app/error.log:42 │
│ "FATAL: connection timeout" │
│ [2] git log output │
│ "commit a1b2c3d..." │
│ [3] curl api response │
│ '{"status": "ok"}' │
│ │
│ Enter: paste Del: delete Esc: close │
└─────────────────────────────────────────┘
Multiple Copy Buffers
Kitty maintains per-window copy buffers. Each window has its own selection, and you can copy from one window and paste into another:
# Control buffer behavior
copy_to_clipboard yes # copy to system clipboard automatically
confirm_os_window_close 0 # prevent accidental close prompts
select_by_word_characters :@-._~ # characters treated as word boundaries for smart select
The select_by_word_characters option is critical for DevOps workflows — it controls which characters are included in double-click word selections. Include :, /, ., @, -, _, ~ to make URLs and file paths selectable as single units.
The Kitty Clipboard Protocol
Kitty implements a clipboard protocol that allows terminal applications to read and write the system clipboard with permission. When an application requests clipboard access:
Application → OSC 52 escape sequence → Kitty → System Clipboard
│
▼
Permission prompt (if needed)
# Allow clipboard access from remote applications (SSH)
allow_clipboard_control yes
# Or restrict to local only
# allow_clipboard_control no
allow_clipboard_control yes lets remote applications (over SSH) read and write your clipboard. Enable only on trusted networks, or leave disabled and use copy-on-select instead.
Practical Workflow: Copying Log Data
1. Tail a log file: tail -f /var/log/syslog
2. See an error line: "ERROR: disk full on /dev/sda1"
3. Triple-click the line → selects entire line
4. Line is auto-copied (copy-on-select)
5. Switch to editor tab (Ctrl+Shift+tab shortcut)
6. Press Ctrl+Shift+v → paste the error line
7. No mouse needed
Common Pitfalls
| Pitfall | Symptom | Fix |
|---|---|---|
| Copy-on-select not working | Selecting text doesn't copy | Check copy_to_clipboard yes in kitty.conf |
| Smart selection picks too much | Double-click selects unwanted chars | Adjust select_by_word_characters to remove punctuation |
| Clipboard kitten shows empty | No history stored | Copy something first, then launch kitty +kitten clipboard |
| Application can't access clipboard over SSH | pbcopy/xclip fails on remote | Enable allow_clipboard_control yes or use local copy-on-select |
| Paste inserts duplicate text | Extra newline or whitespace | Use Ctrl+Shift+v instead of middle-click for exact clipboard content |
Hands-On Practice
# 1) Test copy-on-select
echo "This is a test line for copying"
# Select the line with your mouse → release → text is copied
# 2) Test clipboard paste
# Press Ctrl+Shift+v to paste the line above
# 3) Test smart selection on a path
echo "The config is at /home/user/.config/kitty/kitty.conf"
# Double-click the path → entire path selected and copied
# 4) Use the clipboard kitten
kitty +kitten clipboard &
# 5) Copy something, then check history
echo "first copy" | kitty +kitten clipboard --save-from-stdin
echo "second copy" | kitty +kitten clipboard --save-from-stdin
kitty +kitten clipboard --show
# 6) Configure word characters for DevOps
grep -q "select_by_word_characters" ~/.config/kitty/kitty.conf 2>/dev/null || \
echo "select_by_word_characters :@-._~/" >> ~/.config/kitty/kitty.conf
kitty @ load-config