Skip to main content
Ghostty provides comprehensive clipboard support with configurable behavior for both system clipboard and terminal-initiated clipboard operations.

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

Valid values:
  • 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:
Test clipboard read (if clipboard-read = allow):
Allowing clipboard read (clipboard-read = allow) can be a security risk. Applications can silently read your clipboard contents.

Clipboard Behavior

Trimming Whitespace

Remove trailing whitespace when copying:
Completely blank lines always have their whitespace trimmed.

Clearing Selection

Clear selection after copying:

Paste Protection

Prevent accidental execution of dangerous commands:
1

Protection activates

When pasting text containing newlines, Ghostty shows a confirmation dialog.
2

Bracketed paste exception

If the application has bracketed paste mode enabled, the paste is considered safe and no confirmation is shown (unless clipboard-paste-bracketed-safe = false).

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:
When double-clicking to select a word, selection stops at these characters.

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:
1

Enable OSC 52 write

2

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
3

Copy remotely

When you copy text in the remote application, it appears in your local clipboard.

Example: Neovim Over SSH

Troubleshooting

  1. Verify OSC 52 is enabled: clipboard-write = allow
  2. Ensure remote application supports OSC 52
  3. Check SSH doesn’t strip escape sequences
  4. Test with the OSC 52 printf command shown above
Check copy-on-select is enabled:
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.
If bracketed paste mode is available but still showing confirmation:
Or disable paste protection entirely (not recommended):