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.
- 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'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.