Comment by bitbasher
20 hours ago
This blog post reminds me of _why_ I use tmux. Did you see how much they needed to do to even resemble the workflow of tmux? Jeez, just use tmux. I don't mind dealing with wonky copy and paste once in a while.
> In summary: multiplexers add unnecessary overhead, suffer from a complexity cascade, because they actually have to translate escape codes, modifying them in hackish ways to get them to work with their concepts of windows/sessions.
What does that have to do with you using tmux? You're not the one maintaining tmux's codebase.
> I don't mind dealing with wonky copy and paste once in a while.
This problem is in no way unique to tmux. You have the same problem with any terminal app that takes over drawing, eg vim. That said it is also easy enough to fix.
The solution is OSC52, a terminal escape sequence that the emulator can use to interact with the system clipboard (kitty, alacritty, iterm2 all support this). The first step is to get you a script that writes out data in that protocol. Its easy enough:
Now you can do this:
$ grep my_thing < some.txt | osc52-copy
And whatever got into osc52 is now on your system clipboard.
Tmux (set -g clipboard on) and nvim (unset clipboard) both have native osc52 support, and the script above can be used to integrate other places.
Terminal emulators have taken a very odd attitude toward OSC52. Many (or all?) of them selectively disable either copy, or paste, or both, depending on how cautious the maintainer is.
Yes, it's true that an application that can read system clipboard content may scrape a password, but literally any application running in the terminal can read private keys out of your .ssh folder.
With some heavy reading and a bit of experimentation, you can usually get this working, though.
But with OSC 52, any system I ssh into can scrape those passwords. Bigger attack surface, to be sure. And unfortunately there’s no particularly good way of telling if the received escape code originated from the local machine.
There are lots of ways to secure your private keys though, including passphrases, having a ssh agent that requires interaction to use a key, having them on hardware security keys etc.
Having osc52 paste default off seems very reasonable
I generally use xclip to copy program output. It has been around forever. Otherwise, I pipe into vim or I'm already using vim and I can copy via visual mode with "+y
What is the benefit of this over pbcopy and wl-copy?
If you're working locally I can't think of much. OSC52 works to copy to your local clipboard from a remote system (e.g., over ssh) from within tmux or nvim as long as you are using a terminal that supports it.
I use it to copy from remote system when I'm in nvim (`"+y`).
Here are a couple links that relate to tmux and nvim.
- tmux: https://github.com/tmux/tmux/wiki/Clipboard
- nvim: https://neovim.io/doc/user/provider.html#clipboard-osc52
The benefits it works everywhere, even on the blink app on iPhone when you suddenly have to pull out your phone in an emergency, connect to your tmux session away from your usual workstation.
I am tired of seeing people creating problems out of nowhere. The reasons author gave are stupid and I am gonna question his "7+ years" of tmux usage
I think some people should just admit they love tinkering with their tools instead of saying it is for productivity or whatever.
> and I am gonna question his "7+ years" of tmux usage
Eh, lots of people use tools for ages without digging too deep.