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?
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With