2

I'm using macOS and tmux 3.1c. When copying a text via mouse selection, the highlight will be auto-cleared after copying the text to clipboard, this will make it difficult to keep track the last line you copied when you go back to it:

enter image description here

Is there a way to prevent/disable the auto-clearing of selection after copying? I know about pressing Shift, then selecting the text, and then hitting Cmd + C to copy it to the clipboard, which preserves the selection. But this is relatively inefficient workflow. This is the same behavior with Alacritty/iTerm.

In iTerm, without tmux, selecting a text will auto-copy it in the clipboard, but the selection will not be auto-cleared.

1 Answer 1

4

You are looking for the copy-selection-no-clear command.

For example, if you are using vi mode, you can define y to copy the selection without clearing it:

bind-key -Tcopy-mode-vi y send -X copy-selection-no-clear 

For emacs use the copy-mode table.

4
  • Exactly what I want! Ended up with bind-key -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-selection-no-clear since I usually use the mouse for selection, and it works as intended. Thanks! Mar 15, 2021 at 15:42
  • @RanelPadon glad this helped. don't forget to accept the answer so your question no longer shows up in the unanswered section.
    – laktak
    Mar 16, 2021 at 8:12
  • Sorry, what do you mean of "accept the answer"? I already upvoted your answer. Am I missing something? Thanks Mar 16, 2021 at 10:10
  • 1
    Interesting, didn't know that I could accept an answer also, I should have done this even before in my StackOverflow posts. Although some of them, I ended up the one who solved it also. Cheers stackoverflow.com/help/someone-answers Mar 16, 2021 at 10:16

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.