[FEATURE] Add "Copy to clipboard" button for code blocks and command output
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
When selecting and copying text from Claude Code's terminal UI, extra whitespace and line breaks are inserted due to terminal soft-wrapping. This makes copying
code snippets, SQL queries, and multi-line commands unreliable — the pasted result needs manual cleanup every time.
Tools like Cursor provide a one-click "copy block" button next to code output that copies the raw content cleanly.
Just like you see broken tabs and spaces in the above problem statement
Proposed Solution
Option A: Keyboard shortcut to copy last code block
Add a keybinding (e.g., Ctrl+Shift+C or a custom chord) that copies the
most recent code block or command output to the system clipboard. Fast,
no mouse needed, fits the CLI-first workflow.
### Option B: Inline copy affordance in rendered output
Display a small [Copy] indicator next to each code block / command output
(similar to how Cursor, GitHub, and ChatGPT render copy buttons). Clicking
or pressing a key while focused copies the raw content without terminal
wrapping artifacts.
### Option C: Slash command — /copy
A /copy command that copies the last assistant code block (or Nth block
via /copy 2) to clipboard. Minimal UI change, works in all terminals.
### Any of the above should:
- Copy raw content, not terminal-rendered text (no soft-wrap line breaks)
- Preserve original indentation
- Work across macOS, Linux, and WSL
- Support both code blocks and shell command output
Alternative Solutions
Requested Feature
Add a clickable "copy to clipboard" affordance (button or keyboard shortcut) on:
- Code blocks in assistant responses
- Command output blocks
- Inline code snippets
This should copy the raw content without terminal wrapping artifacts.
## Workarounds Currently Used
- Piping output to
pbcopy(works but requires asking the assistant explicitly) - Writing to temp files and opening in an editor
- Using iTerm2/tmux copy mode (reduces but doesn't eliminate the issue)
## Environment
- macOS (Terminal.app / iTerm2)
- Claude Code CLI
Priority
High - Significant impact on productivity
Feature Category
CLI commands and flags
Use Case Example
You can see everything I have written above has broken tabs and spaces and line breaks.
Additional Context
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗