4

I use Tmux version 1.9. To push tmux's clipboard to my X clipboard I have such a string in tmux.conf:

bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"

The problem is that after pressing C-b C-c content of tmux's buffer goes to the X clipboard, but also all the key bindings stop working.
I can't create a new window, pane, etc.

Has anyone faced such a problem?

UPD

After a about a minute tmux starts responding to C-b bindings.

Glueon
  • 338

3 Answers3

2

Instead of:

bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"

I ended up using this code:

bind -t vi-copy y copy-pipe 'xclip -in -selection clipboard'

With such a binding to copy something to the X clipboard:

  • Press CTRL + b + [
  • Hit the SPACE
  • Select the text using vi-mode key combinations
  • Instead of Enter I hit y and without any freezes text goes to the system clipboard.
Glueon
  • 338
  • Vi-mode is always the right answer, irrespective of the question... :) – jasonwryan Mar 02 '15 at 22:24
  • Unfortunately, this isn't really an answer to the question. The key binding given in the original question is useful if you have selected something with your mouse, but then want to paste in an X window. – Jon Gjengset Apr 08 '16 at 21:16
1

Adding -b to run-shell (or run) command fixes the problem. With -b the shell command is run in the background.

bind C-c run-shell -b "tmux save-buffer - | xclip -i -sel clipboard"

(Credits: this answer)

0

I have this same problem. The way I workaround it is by making a few X selections (by simply highlighting text in my terminal). If I do this a few times tmux seems to "catch up" and starts responding normally again.

mgalgs
  • 167