3

I started using tmux a few months ago. I love it. One of the behaviours however that I can't seem to understand is as follows.

If I go into copy mode and copy a piece of text, it will copy it fine. My setup allows for it to be copied to my macOS clipboard just as fine.

When I copy and paste for a second, third, etc. time, however, previous excerpts that I copied would be part of the text I paste.

Can anybody explain this behavior to me and how I could fix it? It is my understanding that it's intended for tmux to aggregate copied text into a buffer, and that's fine. I just would like to paste single bits of text from time to time (search something on Google, or copying a URL).

1
  • You must be using something that appends to the clipboard rather than overwriting it. Post your .tmuxrc and any other applicable file, and tell us exactly which commands you use. Apr 17, 2020 at 19:31

3 Answers 3

4

If you are using kitty terminal you may use the following configuration on your kitty.conf

clipboard_control write-primary write-clipboard no-append
1
  • Yup, this solved it for me using tmux+nvim+popos Nov 27, 2023 at 19:26
3

1) Are you using Kitty terminal? It has a problem where it appends to the selection instead of replacing it. Does this still happen in Terminal.app or iTerm2?

2) Or are you using both pbcopy and set-clipboard to make tmux set the system clipboard? Try set -s set-clipboard off in .tmux.conf and restart tmux (tmux kill-server).

1
  • 1
    I am using Kitty. Your comment helped me debug and now I was able to come up with a solution. Had to disable the clipboard and manually configure the copy behavior in .tmux.conf using pbcopy. Will answer below. Apr 17, 2020 at 20:56
3

@Nicholas Marriot provided insight that led me to this solution:

https://unix.stackexchange.com/a/564333/406997

In my case I ended up using pbcopy rather than xsel:

set -s set-clipboard off

bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel "pbcopy"
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .