Open jojojames opened 4 years ago
I believe this would be possible, but I'm not sure a lot of terminals support it. Some authors of terminal emulators believe that the OSC features represent a security risk, and refuse to allow the ability to write to the clipboard. I just tested iTerm2, Kitty, and xterm and it seems that only xterm currently supports reading from the system clipboard.
It might be worth adding just for folks who run xterm, with the hopes that more terminal emulators will add it in the future. I'm curious why you think it'd be handy to have? I mean why not use the OS level hotkey to paste from the system clipboard? I personally think it might be nice for the contents I paste from the system clipboard get copied to the kill ring in Emacs.
Actually, I take that back about kitty. You can optionally allow clipboard read via OSC 52 via the the config file.
clipboard_control read-clipboard read-primary write-clipboard write-primary
Very cool.
I'm curious why you think it'd be handy to have? I mean why not use the OS level hotkey to paste from the system clipboard?
I've never found a paste that came from OS clipboard through emacs to paste properly. Using evil along with it makes it even worse. I usually get a lot of random artififacts along with the paste.
+1 for this feature. It will be really handy.
Maybe I' missing something out here:
yy
to my computer clipboard and paste it back?
yy
and p
do work without anything like clipetty@herop:
So Clipetty makes yy
in emacs go to your computer's system clipboard (not Emacs' kill ring) when you're running Emacs in a TTY, which usually doesn't happen otherwise. This particular feature request is to be able to paste the contents of your system clipboard into Emacs using an Emacs binding, rather than hitting whatever key sequence is defined by your system to do this (think Ctrl-V in Windows)
Yes, yy
and p
work fine without Clipetty, in that they copy and paste to Emacs' kill ring, but they don't interface with the system clipboard.
Hope this helps.
Thank you so much for pointing that out. I wrote to you because I expected that to happen but can't find that in you readme. 😄 So to wrap it up:
yy
on Emacs TTY -> Text goes into my computer clipboard andp
will put the recent text from my computer clipboard to where my cursor is in Emacs, right?
y
Text and p
inside Emacs will work, say from buffer A -> B but not from say text I copied from my webrowser and immediately p
inside Emacs. Reason being, I guess: I'm using Windows10 and the Windows Terminal Preview. Very sad, I must admit, since I might one of many users struggle with this culprit.
@herop The second statement you made has not been implemented. And that's the discussion of this thread. Windows Terminal Preview does not have OSC 52 support, so the first statement won't work either. I could not find any decent terminal emulator on Windows. Even Alacritty has some keybinding issue with Emacs on Windows. Hopefully, WT will get more support in the future.
I tried adding support for this:
(defun osc52-paste ()
(clipetty--emit
(concat clipetty--osc-start "?" clipetty--osc-end)))
But I don't know how to read the terminal emulator's answer from the tty. Currently the answer goes as input to emacs which messes it up.
Hi! Amazing package! Thanks for pushing it out. :)
Is your feature request related to a problem? Please describe.
I was wondering how feasible it would be to go "in reverse", that is, copying from the system clipbord (say OSX clipboard) into my ssh->tmux->emacs session.
Thanks for reading!