Getting tmux to copy a buffer to the clipboard
135
votes
17
answers
132538
views
I am trying to figure out a decent way to copy what I have in a tmux buffer into my clipboard. I have tried a couple of different things like
bind-key p select-pane -t 2 \; split-window 'xsel -i -b' \; paste-buffer
which gets me fairly close, all I have to do is hit control-d after I do prefix-p.
I tried fixing that by doing
bind-key p select-pane -t 2 \; split-window 'xsel -i -b << HERE\; tmux paste-buffer\; echo HERE'
But that just doesn't work. In fact if I pair this down to just
bind-key p select-pane -t 2 \; split-window 'xsel -i -b << HERE'
it doesn't do anything so I am assuming that split-window doesn't like << in a shell command.
Any ideas?
Edit:
You can skip the
select-pane -t 2
if you want, it isn't really important. I just use a specific layout and pane 2 is the one I prefer to split when I doing something else so that goes into my bindings involving splits by default.
Asked by Digital Powers
(1857 rep)
Jun 27, 2011, 08:14 PM
Last activity: May 13, 2023, 03:34 PM
Last activity: May 13, 2023, 03:34 PM