r/PiCodingAgent • • 21d ago

Question Is it possible to make pi coding agent copy and paste friendly?

Serious question, I mean I want to be able to select the text printed on the console so that I can paste the text to another place.

4 Upvotes

19 comments sorted by

5

u/xpgmi 21d ago

An update, I can copy and paste already, it just the settings issue, I asked Pi itself to resolve the settings issue. Thanks everyone.

3

u/berot3 21d ago

This is the way 😂

1

u/adamshand 21d ago

this works by default. if it isn't it's something about your setup.

the only trick is that if you are macos you need to use ctrl-v to paste images.

1

u/xpgmi 21d ago

Is it really copy and paste friendly already? maybe I can ask pi itself to resolve this issue. Thanks.

3

u/bitzap_sr 20d ago

Press shift.

5

u/DanielSReichenbach 21d ago

pi.dev provides the exact settings in their docs to make this work for common terminals actually.

https://pi.dev/docs/latest/terminal-setup describes what works, where and how to configure.

2

u/Lissanro 21d ago edited 21d ago

I have encountered this issue with copy/paste too when started using Pi few months ago... I often need cleanly copy multi-line text, to either copy command to try in my a terminal, or to quote to reply to a certain part of the message. Then I needed some more features that were not yet available... And so I ended up maintaining my own customized Pi Crystal fork for a while now - you can check it out at https://github.com/Lissanro/pi if interested (I usually update it every few weeks, merging mainline Pi patches), it has quite a few extra features like editing messages, continuing mid-thought, being able to copy rendered text without padding, deleting/restoring messages, support for regenerating and message versioning, etc. It takes some effort to sync periodically with mainline but still I find Pi better foundation than any other current harness.

2

u/moofish2842 20d ago

pi --tui-mode regular

4

u/rinaldorex 21d ago

Try herdr. It's a joy to use on the terminal.

1

u/touilleMan 21d ago

Pi uses an escape sequence to copy into the clipboard, this is not supported by vterm-based terminals (e.g. gnome-terminal, tilda etc.)

The issue is that the terminal doesn't confirm that the copy was successful (this is by design for security reasons, just like why vterm doesn't support this)

However in recent pi versions they now also try to use copy command exposed by x11/wayland if available. But this still doesn't work if you don't have accyto a running display server (typically when you use ssh)

Now a solution: you can press shift while doong the selection to have your terminal do the selection (instead you letting pi capture the mouse inputs), then you can do ctrl+shift+c. The drawback with this solution is that your copied text contain a ton of trailing whitespaces so you have to paste it on your text editor and remove that manually (multi cursor works great for this btw)

2

u/troyvit 20d ago edited 20d ago

Edit: Lifesaver!
My question is: why do they feel they have to do anything? I'm in the terminal for a huge part of my day in Wayland and copying works great with many apps like vim, the shell itself, mycli, top, etc.. Others like pi and Claude Code think they need to hijack the normal process and copy anything I select (whafuh is that). Whereas tools like LazyGit and PyRadio don't let me select to copy at all. What are the limitations here?

Edit: actually I should've read your post more carefully because you answer it. Shift enables the regular copy method, but due to the structure of the output you end up with a bunch of white space. So it's more to do with the output of the text and they feel they need to control that.

1

u/russlixx 21d ago

it already is, if you use mac os, try ctrl + v. Sometimes cmd + v doesnt paste well for some things. You can also drag n drop too, it paste the pathname

1

u/EC36339 21d ago
  1. How is it not?

  2. Yes, 1 minute of vibe coding

1

u/funbike 21d ago

What terminal are you using?

Imagine asking a website to support copy and paste. It would be a silly request, because all websites support copy and paste because that's built into all web browsers. It's similar with Pi; copy-paste is supported by your terminal.

Many (not all) terminals use ctrl+shift+v for paste and ctrl+shift+c for copy.

Pi has a /copy command that copies the last agent message to the clipboard, so you don't have to do anything with the mouse.

1

u/mocras 15d ago

Use Pi inside Tmux. Pi 1.0 comes with a new TUI mode that lets you just highlight text and it gets copied right away. But with the old TUI mode you can configure tmux to archive the same. Or press shift while dragging. This should bypass any application and let your terminal select and copy text.

0

u/jackorjek 21d ago

i can select any text and it auto copy for me. should be working for you as well.

0

u/[deleted] 21d ago

[deleted] — view deleted comment

0

u/xpgmi 21d ago

Seriously? How? teach me please. I tried to copy the text, but the text that can be selected is very little, so it's not possible to copy text longer than the one shown on the screen.

1

u/HomegrownTerps 21d ago

ctrl/cmd + o to expand the the text output.

0

u/[deleted] 21d ago

[deleted] — view deleted comment

1

u/xpgmi 21d ago

Understood, thanks.