claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Add Clipboard Copy Functionality for Current Prompt

Open nazmulidris opened this issue 1 year ago • 11 comments

Update Aug 15 2025: I made the ch TUI app to implement this feature outside of claude code - https://github.com/anthropics/claude-code/issues/5005#issuecomment-3192509380

Use case

In claude code, I often want to copy the text in my prompt to my clipboard. I save these prompts to sublime text, and then often paste it into vscode + copilot, or gemini.

Suggested shortcut

Would you consider adding a keyboard shortcut (eg: Ctrl+Shift+c) and action to copy the contents of the claude code prompt editor?

vim mode missing this feature too

Even in vim mode, there is no keyboard shortcut to copy the current prompt.

claude code is awesome. Thank you!

nazmulidris avatar Aug 02 '25 22:08 nazmulidris

Even better would be if copy and paste just worked, right? Like OP, I often want to save my prompts elsewhere, or even switch between Claude Code and claude.ai.

The problem of course stems from Claude Code's fancy UI. It's using text characters to draw a box:

╭──────────────────────────────────────────────────────────────────────────╮
│ > Quisque eget odio ac lectus vestibulum faucibus eget in metus.         │
╰──────────────────────────────────────────────────────────────────────────╯
  ? for shortcuts

But, this box really isn't necessary, especially at the cost of breaking copy and paste! It would be just as clear where to type with only the separator lines:

────────────────────────────────────────────────────────────────────────────
> Quisque eget odio ac lectus vestibulum faucibus eget in metus.
────────────────────────────────────────────────────────────────────────────
  ? for shortcuts

And then let the Terminal line wrap the characters itself. No fancy formatting = easy copy and paste.

Here's how it looks with mutliple lines. Note that because Github doesn't wrap text in code blocks, I have to add line breaks (bad for copy and paste) for it to look right on here. However, a Terminal would automatically wrap the text. The idea is that everything from the starting > to the end of your prompt can be plain text, nothing added.

────────────────────────────────────────────────────────────────────────────
> Quisque eget odio ac lectus vestibulum faucibus eget in metus. In
pellentesque faucibus vestibulum. Nulla at nulla justo, eget luctus
tortor. Nulla facilisi. Duis aliquet egestas purus in blandit. Curabitur
vulputate, ligula.
────────────────────────────────────────────────────────────────────────────
  ? for shortcuts

This small change would improve my life. Thanks for considering.

Wowfunhappy avatar Aug 05 '25 15:08 Wowfunhappy

Another option could be to add a new /history-copy command which could display a list of prompts (similar in a way to /resume). Then upon selecting one, the contents of this prompt could be copied to the clipboard and ready to paste wherever.

nazmulidris avatar Aug 06 '25 00:08 nazmulidris

Many times I go back to previous prompts, copy them and paste into a new session to start over from there, but I have to tidy up the copied text from the extra characters and spaces edit: I just found out that in iterm2 I can use opt+command+mouse for rectangular selection which helps a lot.

tamasarpad avatar Aug 14 '25 13:08 tamasarpad

I have actually create a small TUI app called ch (Claude Code History) to be a workaround for this missing feature.

You can see a video of it in action here:

To install it, you have to use rustup. Here is more information on it.

Here are the basic steps on Linux:

# Install rustup (if you don't have this installed already)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Install r3bl-cmdr (which has `ch` in it)
cargo install r3bl-cmdr

# Run `ch`
ch --help

nazmulidris avatar Aug 15 '25 19:08 nazmulidris

I use tmux and the prompt comes out like weird, would like a fix. this should be one line of text, and not include the pipes |.

│ > let's create the plan and pseudocode changes needed.   1. ok let's use create methods 2. what does adding in the ledger accounts look like    │
│   to the model? 3. let's link the contacts 4. if members need a party, can we ensure that the party comes from the chain835, if not, then link  │
│   it to the party in the persistent layer. let's go with creating the party first as well.  I think the member id changes as well, and it       │
│   needs to be reset of something.   I could be wrong though...  5. invoices should contain the bills all the way in the factory classes that    │
│   are generated, we should make the update there 6. testing config is good 7. ok adding payment preference is good.  8. ok, add account         │
│   activation, I assume this is the E6 accounts?  not sure... 9. the config should not have optional configuraitons,  this is going to be        │
│   supplied by the scenario chain835s.  10. TestingData is a global variable in @internal/testing/utils/dynamic_test_data_v2.go just use that    │
│   please                                                                                                                                        │

jackstine avatar Sep 04 '25 19:09 jackstine

Why does copy paste not work? This is modern tech? Can't copy and paste text? What? My experience so far has been abysmal.

edswangren avatar Dec 03 '25 03:12 edswangren

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Jan 02 '26 10:01 github-actions[bot]

+1 to having a special shortcut like ⌘+Shift+C to copy the current prompt to the clipboard. Sometimes I have multiple Claude code instances open and I realize I wrote a long prompt in the wrong window and I'd like to copy the prompt more easily than to select all those wrapped lines with a mouse and strip out all the ascii box characters like a caveman.

nvie avatar Jan 05 '26 16:01 nvie

It is really unexpected to not have a good workaround to copy current prompt to clipboard.

Also in vim mode yy does nothing. Cannot use p afterwards either.

radres avatar Jan 06 '26 12:01 radres

Different use case than the prompt editor shortcut requested here, but related: I made a small skill that adds /yank for general clipboard access.

https://github.com/joelev/yank

Install:

mkdir -p ~/.claude/skills/yank
curl -o ~/.claude/skills/yank/SKILL.md \
  https://raw.githubusercontent.com/joelev/yank/main/SKILL.md

Cross-platform (macOS, Linux, Windows via WSL), ~40 lines. Claude will also offer to yank when generating prompts or snippets you might want to paste elsewhere.

Doesn't solve the keyboard shortcut request, but helps with the general "get stuff onto my clipboard" problem.

joelev avatar Jan 15 '26 02:01 joelev

another request to enable copy to clipboard from saved iOS Xcode conversations. Response from Claude: Unfortunately, there's no built-in way to copy prompts from a previous conversation in Claude Code. Claims it is a tool limitation. I can copy the response text, but not the Prompts. Also, why not provide a simple copy all button for the conversation??? I'll open a bug request with Apple

greglocke03-ctrl avatar Oct 17 '26 17:10 greglocke03-ctrl