[HN Gopher] Clipboard integration between tmux, nvim, zsh, x11, ...
___________________________________________________________________
 
Clipboard integration between tmux, nvim, zsh, x11, across SSH
sessions
 
Author : pmoriarty
Score  : 70 points
Date   : 2022-07-09 17:42 UTC (5 hours ago)
 
web link (blog.landofcrispy.com)
w3m dump (blog.landofcrispy.com)
 
| lordgrenville wrote:
| I just came across this blog post the other day, while trying to
| yank from nvim inside a container inside tmux. (It's my knowledge
| base, so not being able to copy/paste simply is quite annoying.)
| The clipboard doesn't exist if you're not using a windowing
| system, so I had to hook the Vim register to copy to a tmux
| register (and from there use pbcopy to get it to my macOS host).
 
| sa46 wrote:
| I went down this path to madness a few years ago [1]. HN
| discussion [2]. Nowadays, I use IntelliJ for everything.
| 
| [1]: https://blog.d46.us/zsh-tmux-emacs-copy-paste/
| 
| [2]: https://news.ycombinator.com/item?id=17002527
 
| georgia_peach wrote:
| I mostly work in vim via ssh--occasionally inside a tmux session.
| Vim "paste mode", X11 selection, and OSC52 are built-in & have
| all my bases covered. I think this person is engaged in Rube
| Goldberg style procrastination.
| 
| https://www.sobyte.net/post/2022-01/vim-copy-over-ssh/
 
| hn_saver wrote:
| there's a delay between copying something until it can be pasted,
| resulting in pasting something that was copied earlier.
| 
| Also, you can only have one thing working correctly: tmux
| scrolling (mouse mode) or copying.
 
  | wffurr wrote:
  | Seems like a market opportunity here for an app that makes all
  | of this work in a sensible way. Difficulty may be in making it
  | possible to integrate into the target users' idiosyncratic
  | editor+Linux tools setups though. And convincing said users to
  | pay for something instead of hacking config files and scripts.
  | 
  | Maybe something like Warp (https://docs.warp.dev/features/ssh)
  | but built for remote resumable sessions.
 
| shikoba wrote:
| Clipboard is already "synchronized" select a text somewhere,
| middle click somewhere else et voila.
 
  | dvh wrote:
  | Until you close the app where you selected the text and now
  | your clipboard is empty.
  | 
  | Or until you click somewhere, original app loses selection and
  | your clipboard is now empty.
 
    | shikoba wrote:
    | > Until you close the app where you selected the text and now
    | your clipboard is 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.
 
  | deathanatos wrote:
  | On Linux, this is the X11 primary selection, not the clipboard.
 
    | shikoba wrote:
    | It's a clipboard. I use mostly that one. It works everywhere.
 
      | drdaeman wrote:
      | You're both correct. Yes, it acts as a clipboard, for all
      | practical purposes. But also it's a terminology thing.
      | 
      | 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.
 
| rektide wrote:
| as someone who lives in vim (with a bunch of splits), often in
| ssh, copying things out of my editing session has a lifelong
| struggle (because selection doesn't understand splits).
| 
| this article is a good wakeup call, a reminder i've been living
| with a bad situation that deserves some attention.
 
  | jewel wrote:
  | Can you ctrl-click and drag to select a rectangular area? That
  | works for me in Gnome terminal in that situation, if I'm
  | understanding you correctly.
 
    | augusto-moura wrote:
    | Yes and no, at least for me, I have the option of printing
    | whitespace chars as some printable ones (tabs vs spaces).
    | Copying via tmux or the terminal emulator also pick them up,
    | while yanking them on vim does not. Also I'm already too
    | comfortable on vim yank keybindings, the combo yank with
    | movements are very powerful
 
| Fnoord wrote:
| Wl-clipboard for Wayland. But honestly, since I use some legacy X
| apps like Wine, it is a mess.
| 
| 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.
 
___________________________________________________________________
(page generated 2022-07-09 23:00 UTC)