4 ms·
Does this work for a tmux session on a remote host? Seems like it would only work with access to the local system clipboard
by cauthon 6y ago
Does this work for a tmux session on a remote host? Seems like it would only work with access to the local system clipboard
- jcard 6y agoThis should work the same locally & on remote hosts. Tmux doesn't care that you're ssh'd into some host. As long as your system & version of tmux supports copying to the local clipboard, you should have no problems pasting with either Ctrl/Cmd+v or `Ctrl+b ]`. Otherwise, if the clipboard is broken for some reason, you can stick to using `Ctrl+b ]` to paste.
- ianthehenry 6y agoIt... depends. If your terminal emulator supports the clipboard escape codes, then yes -- it just works, and there's nothing for you to do to set it up. This is because when you hit "copy" tmux just prints a bunch of escape codes, and ssh will re-print the escape codes locally, and your terminal emulator will see them, and know to set the contents of the system clipboard. If your terminal emulator doesn't support the clipboard escape codes, then you have to configure an explicit copy-pipe command, like this: bind -T copy-mode-vi y send -X copy-pipe 'xclip -i -selection clipboard' And that will work on a remote tmux, as long as you ssh to the remote server with X forwarding (ssh -X or -Y). If you're not using X and your terminal emulator doesn't support the escape codes, then I think the answer is no. Like if you're using a Mac and using Terminal.app instead of iTerm, I'm not sure how you would make this work.
- bryogenic 6y agoI took this tmux config line to the next level because: - I want it yanked into both the selection AND the default clipboard - I want tmux to exit copy mode after yanking bind -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -in -selection default; xclip -o | xclip -in -selection clipboard'