I want to use ctrl+w in tmux session to copy contents into system clipboard, follow some google search result, I add in ~/.tmux.config the line:

bind -t vi-copy y copy-pipe "xclip -sel clip -i"

then tmux source ~/.tmux.config but with ctrl+w I can only copy highlighted text to other tmux session, not system clipboard. can someone help?

  • isn't xclip a graphical Program? So maybe use export DISPLAY=:0 so you use the hosts xserver – kai-dj Jul 8 '18 at 8:24
  • @kai-dj I tried export DISPLAY=:0 but not work – K.Wanter Jul 8 '18 at 10:44
  • are you using tmux thru a remote connection ? – EchoMike444 Jul 8 '18 at 17:36
  • @EchoMike444 yes, right, how to deal with this case? – K.Wanter Jul 16 '18 at 1:09
  • if you are using a remote connection , you want may be to forward the display , so that you to use ssh with -X . – EchoMike444 Jul 18 '18 at 4:55

Your Answer

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

Browse other questions tagged or ask your own question.