When use xst not in tmux, clipboard somehow share the same with the system/os/or-whatever-idk, but I can copy from firefox/chrome and paste into xst.

But with tmux I can't do that, tmux only allow use its own buffer, how to make tmux use the system buffer that share with other program?


tmux needs help from xsel (or another X clipboard manager).

I use xsel and add this to my ~/.tmux.conf, which will allow CTRL+B CTRL+C (copy) and CTRL+B CTRL+X (paste) to/from the X (PRIMARY) clipboard into the tmux selection buffer (and vice versa).

# turn on clipboard
set -g set-clipboard on

# copy tmux's selection buffer into the X clipboard selection
bind-key C-c run-shell "tmux show-buffer | xsel -b -i" \; \
display-message "Clipboard buffer copied to xsel ..."

# copy X clipboard selection into tmux's selection buffer
bind-key C-x run-shell "xsel -b -o | tmux load-buffer -" \; \
display-message "Clipboard buffer copied from xsel ..."
| improve this answer | |
  • Not quite sure but enable clipboard and all set set -g set-clipboard on. I can now use system buffer via pre-defined paste shortcut keyboard from system and do paste. – Tuyen Pham Nov 6 '18 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.