yann-qu

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

通过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无效。

posted on 2024-02-15 20:32  yann-qu  阅读(14)  评论(0编辑  收藏  举报