通过ssh同步tmux剪贴板内容
通过ssh连接远程服务器时,可以通过xclip同步tmux剪贴板内容。这需要在服务器上安装xclip,且需要在ssh远程连接时开启X11。
此处附tmux剪贴板调用xclip的配置:
# Copy the current buffer to the system clipboard
bind C-c run -b "tmux save-buffer - | xclip -i -sel clipboard; tmux display-message \"Tmux buffer saved to clipboard\""# Pull the content from xclip into a new tmux buffer and then pastes it into the selected tmux window or pane
bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
注意:一定要在远程连接时开启X11,否则xclip无效。