Keyboard shortcuts in Tmux deactivated after using xclip

≯℡__Kan透↙ 提交于 2019-12-21 04:57:05

问题


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"

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

What is wrong in my config?


回答1:


According to https://wiki.archlinux.org/index.php/Tmux#X_clipboard_integration:

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.

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"



回答2:


For me, a switch to xsel instead of xclip did the trick.



来源:https://stackoverflow.com/questions/19101735/keyboard-shortcuts-in-tmux-deactivated-after-using-xclip

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!