使用 xclip 后 Tmux 中的键盘快捷键停用 [英] Keyboard shortcuts in Tmux deactivated after using xclip

查看:17
本文介绍了使用 xclip 后 Tmux 中的键盘快捷键停用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 .tmux.conf 中使用以下配置从 xclip 来回复制文本

I am using the following configuration in my .tmux.conf to copy text to-and fro from xclip

bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"
bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"

如果我运行 C-prefix Cc 例如,文本被粘贴到另一个应用程序中,但之后没有任何 tmux 命令在 tmux 终端中工作(例如 C-prefix [ 进入复制模式等)

If I run C-prefix C-c for e.g, the text is pasted into another application but after that none of the tmux commands work in the tmux terminal (e.g. C-prefix [ to go into copy-mode etc.)

我的配置有什么问题?

推荐答案

根据 https://wiki.archlinux.org/index.php/Tmux#X_clipboard_integration:

xclip 从 tmux 的缓冲区读取后似乎没有关闭 STDOUT.因此,tmux 不知道复制任务已完成,并继续/await xclip 的终止,从而使窗口管理器无响应.要解决此问题,您可以通过 run-shell -b 而不是 run 来执行命令,您可以将 xclip 的 STDOUT 重定向到/dev/null,或者您可以使用像 xsel 这样的替代命令.

It seems xclip does not close STDOUT after it has read from tmux's buffer. As such, tmux doesn't know that the copy task has completed, and continues to /await xclip's termination, thereby rendering the window manager unresponsive. To work around this, you can execute the command via run-shell -b instead of run, you can redirect STDOUT of xclip to /dev/null, or you can use an alternative command like xsel.

PREFIX C-c 绑定更新为以下内容为我修复了它:

Updating the PREFIX C-c binding to the following fixed it for me:

bind C-c run "tmux save-buffer - | xclip -i -sel clipboard > /dev/null"

这篇关于使用 xclip 后 Tmux 中的键盘快捷键停用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆