Feature request: Paste to attach image #657

Open
opened 2026-02-16 17:27:44 -05:00 by yindo · 29 comments
Owner

Originally created by @Jawkx on GitHub (Jul 12, 2025).

Originally assigned to: @kommander on GitHub.

Not sure how possible it is, but I really enjoy using excalidraw when working with opencode. I like to copy the stuff as png and then paste it in LLMs to use. But opencode only support attachment via drag and drop, wonder is it possible to implement paste to add image

Image
Originally created by @Jawkx on GitHub (Jul 12, 2025). Originally assigned to: @kommander on GitHub. Not sure how possible it is, but I really enjoy using `excalidraw` when working with opencode. I like to copy the stuff as png and then paste it in LLMs to use. But opencode only support attachment via drag and drop, wonder is it possible to implement paste to add image <img width="670" height="710" alt="Image" src="https://github.com/user-attachments/assets/c5c36be1-555f-49b9-9cba-7dd1432b02d0" />
yindo added the opentuibug labels 2026-02-16 17:27:44 -05:00
Author
Owner

@almirsarajcic commented on GitHub (Jul 12, 2025):

Correct me if I'm wrong, but you can paste using Control (not Command) + V.
I use that all the time both in opencode and Claude Code.
Check the keyboard shortcuts with /help.

For example, I screenshot part of the screen with Control + Shift + Command + 4, and then paste in using Control + V.
This is how it appears in the opencode.
Image

@almirsarajcic commented on GitHub (Jul 12, 2025): Correct me if I'm wrong, but you can paste using Control (not Command) + V. I use that all the time both in opencode and Claude Code. Check the keyboard shortcuts with /help. For example, I screenshot part of the screen with Control + Shift + Command + 4, and then paste in using Control + V. This is how it appears in the opencode. <img width="630" height="120" alt="Image" src="https://github.com/user-attachments/assets/2911d56e-90a5-4f2a-a238-d2deef6bedc7" />
Author
Owner

@Jawkx commented on GitHub (Jul 12, 2025):

@almirsarajcic Owh ya it works with CTRL+V.

But IMO should work for CMD + V for Macos. But feel free to close this issue if it's redundant

@Jawkx commented on GitHub (Jul 12, 2025): @almirsarajcic Owh ya it works with CTRL+V. But IMO should work for CMD + V for Macos. But feel free to close this issue if it's redundant
Author
Owner

@RomanKornev commented on GitHub (Jul 12, 2025):

I was also confused until I tried Ctrl+V instead of Cmd+V. It just doesn't feel intuitive enough.

@RomanKornev commented on GitHub (Jul 12, 2025): I was also confused until I tried Ctrl+V instead of Cmd+V. It just doesn't feel intuitive enough.
Author
Owner

@ggaabe commented on GitHub (Jul 30, 2025):

this seems to work with CMD V?

@ggaabe commented on GitHub (Jul 30, 2025): this seems to work with CMD V?
Author
Owner

@woerndl commented on GitHub (Aug 31, 2025):

The documentation was a bit confusing (to me at least) in this regard, it states:

Drag and drop images into the terminal to add them to the prompt.

For me, copy‑and‑paste attaches the image as a [Image #1] placeholder, whereas dragging and dropping only inserts the path.

@woerndl commented on GitHub (Aug 31, 2025): The [documentation](https://opencode.ai/docs/#add-features) was a bit confusing (to me at least) in this regard, it states: > Drag and drop images into the terminal to add them to the prompt. For me, copy‑and‑paste attaches the image as a `[Image #1]` placeholder, whereas dragging and dropping only inserts the path.
Author
Owner

@amanhigh commented on GitHub (Sep 5, 2025):

I tried in Arch Linux and here too. Ctrl + V Normal paste doesn't work.

For me Windows (Meta) Key + V Pasted Image. Text is pasted via Ctrl + V hence this is not intuitive

@amanhigh commented on GitHub (Sep 5, 2025): I tried in Arch Linux and here too. Ctrl + V Normal paste doesn't work. For me Windows (Meta) Key + V Pasted Image. Text is pasted via Ctrl + V hence this is not intuitive
Author
Owner

@jawadqur commented on GitHub (Sep 16, 2025):

This would be a sick feature to have in opencode!

@jawadqur commented on GitHub (Sep 16, 2025): This would be a sick feature to have in opencode!
Author
Owner

@rekram1-node commented on GitHub (Sep 16, 2025):

what os and terminal are you @jawadqur pasting images works for me

@rekram1-node commented on GitHub (Sep 16, 2025): what os and terminal are you @jawadqur pasting images works for me
Author
Owner

@felipeorlando commented on GitHub (Sep 18, 2025):

cmd+v would be better 1️⃣

@felipeorlando commented on GitHub (Sep 18, 2025): cmd+v would be better ➕ 1️⃣
Author
Owner

@sai-sy commented on GitHub (Sep 29, 2025):

There seems to be some weirdness here with wsl2 and wezterm on recognizing there's something to paste. Not sure where to start on looking for a fix

@sai-sy commented on GitHub (Sep 29, 2025): There seems to be some weirdness here with wsl2 and wezterm on recognizing there's something to paste. Not sure where to start on looking for a fix
Author
Owner

@rekram1-node commented on GitHub (Sep 29, 2025):

@sai-sy what happens does it just paste the path?

@rekram1-node commented on GitHub (Sep 29, 2025): @sai-sy what happens does it just paste the path?
Author
Owner

@sai-sy commented on GitHub (Sep 29, 2025):

does literally nothing


Thanks!
He/Him
Saihaan "Sai" Syed

On Mon, Sep 29, 2025 at 1:05 AM Aiden Cline @.***>
wrote:

rekram1-node left a comment (sst/opencode#906)
https://github.com/sst/opencode/issues/906#issuecomment-3344916673

@sai-sy https://github.com/sai-sy what happens does it just paste the
path?


Reply to this email directly, view it on GitHub
https://github.com/sst/opencode/issues/906#issuecomment-3344916673, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AR3GQZLGA75QF4R7VI4SIOL3VC4YFAVCNFSM6AAAAACBLKBGMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGNBUHEYTMNRXGM
.
You are receiving this because you were mentioned.Message ID:
@.***>

@sai-sy commented on GitHub (Sep 29, 2025): does literally nothing --- Thanks! He/Him Saihaan "Sai" Syed On Mon, Sep 29, 2025 at 1:05 AM Aiden Cline ***@***.***> wrote: > *rekram1-node* left a comment (sst/opencode#906) > <https://github.com/sst/opencode/issues/906#issuecomment-3344916673> > > @sai-sy <https://github.com/sai-sy> what happens does it just paste the > path? > > — > Reply to this email directly, view it on GitHub > <https://github.com/sst/opencode/issues/906#issuecomment-3344916673>, or > unsubscribe > <https://github.com/notifications/unsubscribe-auth/AR3GQZLGA75QF4R7VI4SIOL3VC4YFAVCNFSM6AAAAACBLKBGMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGNBUHEYTMNRXGM> > . > You are receiving this because you were mentioned.Message ID: > ***@***.***> >
Author
Owner

@rekram1-node commented on GitHub (Sep 29, 2025):

ooo @itsrainingmani note: windows image pasting doesn’t seem to work

@rekram1-node commented on GitHub (Sep 29, 2025): ooo @itsrainingmani note: windows image pasting doesn’t seem to work
Author
Owner

@sai-sy commented on GitHub (Sep 30, 2025):

@rekram1-node I'm gonna make a new issue since this thread seems faily mac specific. I'm also curious if this is a wezterm issue, however since wezterm is listed as being one of multiple options which are necessary to get opencode run properly, i think it's relevant

https://github.com/sst/opencode/issues/2878

@sai-sy commented on GitHub (Sep 30, 2025): @rekram1-node I'm gonna make a new issue since this thread seems faily mac specific. I'm also curious if this is a wezterm issue, however since wezterm is listed as being one of multiple options which are necessary to get opencode run properly, i think it's relevant https://github.com/sst/opencode/issues/2878
Author
Owner

@ibehnam commented on GitHub (Nov 20, 2025):

guys any update on this? I can drag and drop images but they don't get sent to the AI. But when I copy and paste the image, it works. Tried with glm-4.5v.

@ibehnam commented on GitHub (Nov 20, 2025): guys any update on this? I can drag and drop images but they don't get sent to the AI. But when I copy and paste the image, it works. Tried with glm-4.5v.
Author
Owner

@jawadqur commented on GitHub (Nov 20, 2025):

For me it was using ctrl + v instead cmd + v that fixed the issue on opencode and codex 😅

@jawadqur commented on GitHub (Nov 20, 2025): For me it was using ctrl + v instead cmd + v that fixed the issue on opencode and codex 😅
Author
Owner

@rekram1-node commented on GitHub (Nov 20, 2025):

@ibehnam what terminal are u in, some of them dont send that drag & drop the same

@rekram1-node commented on GitHub (Nov 20, 2025): @ibehnam what terminal are u in, some of them dont send that drag & drop the same
Author
Owner

@rekram1-node commented on GitHub (Nov 20, 2025):

and what os r u

@rekram1-node commented on GitHub (Nov 20, 2025): and what os r u
Author
Owner

@juliusz-cwiakalski commented on GitHub (Nov 29, 2025):

Does not work on Ubuntu/terminator:

➜  opencode --version
1.0.120
➜  uname -a
Linux juliusz-Latitude-5421 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
➜  terminator --version
terminator 2.1.3

also does not work in terminal running in Intellij

@juliusz-cwiakalski commented on GitHub (Nov 29, 2025): Does not work on Ubuntu/terminator: ```bash ➜ opencode --version 1.0.120 ➜ uname -a Linux juliusz-Latitude-5421 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux ➜ terminator --version terminator 2.1.3 ``` also does not work in terminal running in Intellij
Author
Owner

@dhruvkej9 commented on GitHub (Jan 2, 2026):

@rekram1-node I use WSL Ubuntu and the screenshot does get's pasted using CTRL + V, text paste works fine, the image I can paste in vscode, and copilot chat as well but with opencode does not works.

@dhruvkej9 commented on GitHub (Jan 2, 2026): @rekram1-node I use WSL Ubuntu and the screenshot does get's pasted using CTRL + V, text paste works fine, the image I can paste in vscode, and copilot chat as well but with opencode does not works.
Author
Owner

@ezhupa99 commented on GitHub (Jan 3, 2026):

Hey,

I am having the same issue:

On Windows Terminal, pwsh

Whatever I try, CTRL + V or ALT + V ( this works on claude code ) I don't see any visual feedback that the image is included in the prompt. I even tried CTRL + ALT + V

@ezhupa99 commented on GitHub (Jan 3, 2026): Hey, I am having the same issue: On Windows Terminal, pwsh Whatever I try, CTRL + V or ALT + V ( this works on claude code ) I don't see any visual feedback that the image is included in the prompt. I even tried CTRL + ALT + V
Author
Owner

@tyrellshawn commented on GitHub (Jan 5, 2026):

I would like to help out in this situation. Any ideas which libraries would need to be changed to make the support work with the Command + V combination? @kommander Im sure you have enough on your plate and I just restocked some Claude credits.

@tyrellshawn commented on GitHub (Jan 5, 2026): I would like to help out in this situation. Any ideas which libraries would need to be changed to make the support work with the Command + V combination? @kommander Im sure you have enough on your plate and I just restocked some Claude credits.
Author
Owner

@kommander commented on GitHub (Jan 5, 2026):

@tyrellshawn capturing super modifiers and especially something like cmd+c/v is tricky and not supported by all terminals, not even with kitty keyboard protocol.

If you have an image buffer in your clipboard which was properly put there as such, it should start with a file signature (magic bytes) that needs to be parsed to recognise raw image/file data. I would implement that parsing in opentui when data is pasted, checking for magic bytes, parse the header if present and add a fileType: string to the paste event, possibly with metadata from the header. That would solve it generically on library level.

Optionally, as the raw pasted data is just emitted with the paste event, opencode can do the magic byte parsing and recognize image types. I would prefer that on library level to generalise for other apps.

Then opencode needs to handle that raw data, either storing a temp file and referencing it or putting it into the session as message part directly.

@kommander commented on GitHub (Jan 5, 2026): @tyrellshawn capturing super modifiers and especially something like cmd+c/v is tricky and not supported by all terminals, not even with kitty keyboard protocol. If you have an image buffer in your clipboard which was properly put there as such, it should start with a file signature (magic bytes) that needs to be parsed to recognise raw image/file data. I would implement that parsing in opentui when data is pasted, checking for magic bytes, parse the header if present and add a `fileType: string` to the paste event, possibly with `metadata` from the header. That would solve it generically on library level. Optionally, as the raw pasted data is just emitted with the paste event, opencode can do the magic byte parsing and recognize image types. I would prefer that on library level to generalise for other apps. Then opencode needs to handle that raw data, either storing a temp file and referencing it or putting it into the session as message part directly.
Author
Owner

@tyrellshawn commented on GitHub (Jan 5, 2026):

@kommander Thank you for the quick and well detailed response. Another reason why I think your product is doing great and will become the best is the ability to articulate these concepts in a respectful and easy to understand way and I appreciate that. That being said if any contribution could be provided to help on a library level I would be interested in learning more!

On a completely separate note something that comes to mind is creating a terminal on top of opentui that could potentially make something like this less tricky?

@tyrellshawn commented on GitHub (Jan 5, 2026): @kommander Thank you for the quick and well detailed response. Another reason why I think your product is doing great and will become the best is the ability to articulate these concepts in a respectful and easy to understand way and I appreciate that. That being said if any contribution could be provided to help on a library level I would be interested in learning more! On a completely separate note something that comes to mind is creating a terminal on top of opentui that could potentially make something like this less tricky?
Author
Owner

@kommander commented on GitHub (Jan 6, 2026):

It will have an integrated terminal with ghostty-vt, there is unfortunately nothing I know of that would make this easier that way. If you want you can give it a shot in the opentui repo. Ask claude to parse magic bytes and a potential image header for paste data in the keyhandler and to extend the paste event with an optional file type and file meta data. It should be able to generate some tests for the keyhandler and stdin.buffer around that.

@kommander commented on GitHub (Jan 6, 2026): It will have an integrated terminal with ghostty-vt, there is unfortunately nothing I know of that would make this easier that way. If you want you can give it a shot in the opentui repo. Ask claude to parse magic bytes and a potential image header for paste data in the `keyhandler` and to extend the paste event with an optional file type and file meta data. It should be able to generate some tests for the `keyhandler` and `stdin.buffer` around that.
Author
Owner

@dhruvkej9 commented on GitHub (Jan 12, 2026):

what os and terminal are you @jawadqur pasting images works for me

WSL2 Ubuntu, pasting don't work at all

@dhruvkej9 commented on GitHub (Jan 12, 2026): > what os and terminal are you @jawadqur pasting images works for me WSL2 Ubuntu, pasting don't work at all
Author
Owner

@tyrellshawn commented on GitHub (Jan 13, 2026):

Hey @kommander I have developed a PR here https://github.com/anomalyco/opentui/pull/520 and tested on my setup. Seems like its handling the paste events fairly well but I'm sure the code could be better but worth a shot. lmk

@tyrellshawn commented on GitHub (Jan 13, 2026): Hey @kommander I have developed a PR here https://github.com/anomalyco/opentui/pull/520 and tested on my setup. Seems like its handling the paste events fairly well but I'm sure the code could be better but worth a shot. lmk
Author
Owner

@eduardozf commented on GitHub (Feb 5, 2026):

I’m having the same issue when pasting images into the terminal, but I noticed it only happens in Windows Terminal. When I switched to Git Bash, it worked normally.

@eduardozf commented on GitHub (Feb 5, 2026): I’m having the same issue when pasting images into the terminal, but I noticed it only happens in Windows Terminal. When I switched to Git Bash, it worked normally.
Author
Owner

@ezhupa99 commented on GitHub (Feb 11, 2026):

I’m having the same issue when pasting images into the terminal, but I noticed it only happens in Windows Terminal. When I switched to Git Bash, it worked normally.

@eduardozf and seems like opencode opens way much faster on Git Bash than in Windows Terminal, nice catch

@ezhupa99 commented on GitHub (Feb 11, 2026): > I’m having the same issue when pasting images into the terminal, but I noticed it only happens in Windows Terminal. When I switched to Git Bash, it worked normally. @eduardozf and seems like opencode opens way much faster on Git Bash than in Windows Terminal, nice catch
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#657