Basic Clipboard Operations
Copy and Paste
Copy
Select text and it’s automatically copied (Linux/macOS default).Or use:
- macOS:
cmd+c - Linux:
ctrl+shift+c
Paste
- macOS:
cmd+v - Linux:
ctrl+shift+v - Middle-click: Paste selection (Linux)
Copy on Select
Automatically copy selected text to clipboard:~/.config/ghostty/config
On Linux, middle-click paste uses the selection clipboard and works even when
copy-on-select is false.Right-Click Actions
Configure what right-click does:OSC 52 Support
OSC 52 allows terminal applications to read from and write to the system clipboard. This is particularly useful for clipboard operations over SSH.Configuration
ask- Prompt the user (default for clipboard-read)allow- Allow unconditionally (default for clipboard-write)deny- Deny all access
Testing OSC 52
Test clipboard write support:clipboard-read = allow):
Clipboard Behavior
Trimming Whitespace
Remove trailing whitespace when copying:Completely blank lines always have their whitespace trimmed.
Clearing Selection
- After Copying
- When Typing
Clear selection after copying:
Paste Protection
Prevent accidental execution of dangerous commands:Advanced Features
Clipboard Character Mapping
Replace specific Unicode characters when copying to clipboard:This only applies to text copying, not URL copying.
Selection Word Characters
Define what characters mark word boundaries during selection:Keybinding Examples
Platform Differences
macOS
- Uses the system pasteboard
- Supports rich text copying (with formatting)
- Integrates with Universal Clipboard (copy on Mac, paste on iPhone)
Linux
- Two clipboards: selection (middle-click) and system (ctrl+v)
- Selection clipboard is automatically populated when selecting text
- System clipboard requires explicit copy action
SSH and Remote Clipboard
When connected to a remote host via SSH, OSC 52 allows remote applications to access your local clipboard:Configure remote app
Many applications support OSC 52:
- tmux:
set -s set-clipboard on - vim: Use plugins like vim-oscyank
- neovim: Built-in OSC 52 support
Example: Neovim Over SSH
Troubleshooting
Clipboard not working over SSH
Clipboard not working over SSH
- Verify OSC 52 is enabled:
clipboard-write = allow - Ensure remote application supports OSC 52
- Check SSH doesn’t strip escape sequences
- Test with the OSC 52 printf command shown above
Selection not copying automatically
Selection not copying automatically
Check
copy-on-select is enabled:Middle-click paste not working (Linux)
Middle-click paste not working (Linux)
Middle-click paste is always enabled and uses the selection clipboard. Make sure you’ve selected text first, or check if another application has cleared the selection.
Paste confirmation dialog appearing too often
Paste confirmation dialog appearing too often
If bracketed paste mode is available but still showing confirmation:Or disable paste protection entirely (not recommended):
Related Configuration
- selection-foreground - Selection colors
- selection-background - Selection background
- keybind - Customize copy/paste shortcuts
- OSC 52 specification