5

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?

RAbraham
  • 5,956
  • 8
  • 45
  • 80

2 Answers2

13

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"
Jason Axelson
  • 4,485
  • 4
  • 48
  • 56
G Mawr
  • 1,135
  • 11
  • 18
0

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

Marcus K.
  • 980
  • 11
  • 26