NOTICE:
I use terms remote and local to refer remote server and local computer that access the server
make sure your terminal which is used to run ssh is support osc 52 (st
by default disable this functionality, see references) and put the following tmux config on the remote server:
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "tmux save-buffer - | base64 | tr -d '\n' | printf '\033]52;c;%s\007' $(cat -)"
apply the changes by tmux source ~/.tmux.conf
.
and on your local config, check tmux show -s set-clipboard
and make sure the output is not 'off', see the man page.
tmux info|grep Ms
references:
- clipboard on tmux wiki
- a nice article and another article that discuss how to configure tmux for osc 52
- alacritty terminal once had a problem with OSC 52 support, tracked on this github issue
- st terminal by default disable this feature for security reason
- reddit user post a question about osc 52 support for st on suckless subreddit
- osc 52 overview on vim subreddit