Clipboard integration between tmux, nvim, zsh, x11, across SSH sessions
blog.landofcrispy.com
blog.landofcrispy.com
I assumed everybody and everything was heading towards this as a standard nowadays. But the article obviously demonstrates that that isn't the case. But the only reason it gives for not using OSC52 is that it has the potential to lag for large copy/pastes, which I've never (knowingly) experienced in quite some years of use. I assume there must be security implications too, but it doesn't go into them.
Considering the ubiquitous, consistent simplicity of OSC52 I would have thought it needed a lot more discussion in this article in order to justify the quite frankly surprising hoop jumping of the author's solution. I'm not saying it's unjustified, just that I need more contextualisation against what I consider the de facto standard for a unified TTY clipboard.
I had no idea that OSC escape sequences were a thing until then and now I think they're the best.
Thanks for the heads up
Need to figure out an equally simple solution for CLI paste support though.
Or until you click somewhere, original app loses selection and your clipboard is now empty.
Ho, I used it for years, and you made me discover that strange property. Interesting.
> Or until you click somewhere, original app loses selection and your clipboard is now empty.
Yes, it's a very volatile clipboard, but if you expect your clipboard to have a lifespan greater than 5 seconds, you're probably doing something wrong.
If you'd open ICCCM, it uses name "CLIPBOARD" for a different selection atom: https://www.x.org/releases/X11R7.6/doc/xorg-docs/specs/ICCCM... So in X11 the term "clipboard" (in a technical, not colloquial sense) is reserved for a different selection. And thus primary selection is not a clipboard.
this article is a good wakeup call, a reminder i've been living with a bad situation that deserves some attention.
The same workflow works for tmux panes and emacs windows too.
I can also copy text from any application and paste it in gvim either in a window or in a terminal running a shell or another program like a nested vim instance and paste the text from the * or + register (depending on how I copied it).
The only issue I have is linebreaks introduced by the terminal if I copy multiple lines of text. In that case, I paste the text in a gvim window, linewise visually highlight the pasted text and use the gJ combination to join all the lines without any intervening whitespace.
I can use standard vim keybindings to copy text from the terminal to the clipboard:
ctrl-w N
?some text
shift-v
/some other text
"+y
Back when I used to use screen for a terminal buffer, the process was a bit more convoluted (copying the text to a screen register, writing it out to a file and reading the file into xclip IIRC). The experience just using (g)vim has been a lot better :)I use vim and love it, but I must say your workflow seems more in line with emacs .
https://github.com/hossbeast/meshboard
Distributed clipboard, mesh networking, xorg and Wayland integration. tmux and vim would also make sense, as OP has done, though I haven't gotten there yet.
I have the issue of remote (via SSH) tmux. It just does not want to copy/paste. On macOS I don't have the issue as long as I stay local.
Also, you can only have one thing working correctly: tmux scrolling (mouse mode) or copying.
Maybe something like Warp (https://docs.warp.dev/features/ssh) but built for remote resumable sessions.
It has something to do with the terminal but this seems to work in every terminal application