Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keyboard shortcuts in Tmux deactivated after using xclip

Tags:

tmux

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"

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?

like image 447
RAbraham Avatar asked Sep 30 '13 18:09

RAbraham


1 Answers

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"
like image 102
G Mawr Avatar answered Sep 21 '22 08:09

G Mawr