6

I have problem with bindings in tmux 1.8.

Problem appear when I type command which run shell For example:

bind y run-shell "tmux show-buffer | xclip -sel clip -i"

And i type y After execution command, tmux not respond on any other bindings (for example w) It may take a few minutes and then you can use bindings.

what could be the problem? It appeared in version 1.8 (with version 1.7 all ok) OS Ubuntu 13.04(64)

maksimr
  • 4,891
  • 2
  • 23
  • 22
  • possible duplicate of [Keyboard shortcuts in Tmux deactivated after using xclip](http://stackoverflow.com/questions/19101735/keyboard-shortcuts-in-tmux-deactivated-after-using-xclip) – eugenevd Jun 26 '14 at 06:55

3 Answers3

11

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.

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

Piping the output to /dev/null should fix it:

bind y run-shell "tmux show-buffer | xclip -sel clip -i > /dev/null"

See https://stackoverflow.com/a/21190234/109282 for more info.

Jason Axelson
  • 4,485
  • 4
  • 48
  • 56
G Mawr
  • 1,135
  • 11
  • 18
2

The problem is that tmux is waiting for that command to return, and it hangs. This effectively locks you from executing any tmux commands. I got around this problem by adding -b after run-shell which makes the commands run in the background. A problem is that those processes hang around, so this isn't a perfect solution.

Another way around this problem is to close the window and reattach the session.

Yakloin
  • 21
  • 3
  • That does work, but why is xclip not returning? I can run that xclip command directly at the command line, and it works instantly. – Isaac Dontje Lindell Jan 19 '14 at 23:32
  • if it is waiting for some command, that you have not intentionally executed, pressing Ctrl C could remedy the situation. – naveed Jan 31 '14 at 10:15
0

Just changing 'tmux show-buffer' to 'tmux save-buffer -' generally improved tmux' behaviour for me in these circumstances. 'show-buffer' redirected to a file was hanging indefinitely for me, and also piping it to xclip was causing unwanted wrapping of long lines, whereas 'save-buffer -' (as per the thread linked by G Mawr) works perfectly.

I suspect because 'show-buffer' assumes it's talking to a terminal, and 'save-buffer' does not.

E.T.A. I'm using tmux-1.6-3, so relevance may be limited.

Annihilannic
  • 159
  • 2
  • 2