adamsfamily
adamsfamily

Reputation: 1974

How to disable mouse copy while keeping mouse scroll in tmux?

I'm running tmux via ssh on a linux (remote) machine from an iTerm2 on macOS.

I've configured .tmux.conf in order to get mouse wheel scrolling inside of tmux via the following:

set -g mouse on

This enables mouse wheel scrolling, copy to clipboard on mouse drag and others.

Can I keep mouse wheel scrolling but disable copy on mouse drag to clipboard at the same time?

Upvotes: 7

Views: 2888

Answers (3)

John Smith
John Smith

Reputation: 2330

When tmux has the mouse mode on (set -g mouse on), then in iTerm on macOS you can press the option key (= alt key) to temporary disable sending mouse events to the terminal application (and thus you can mark lines in the terminal as you are used to).

This also allows you to scroll back in your buffer to before you started tmux.

Upvotes: 0

exebook
exebook

Reputation: 33970

Here is the best behaviour I was able to get from tmux so far

set -g mouse on
unbind-key MouseDown2Pane
unbind-key MouseDragEnd1Pane
bind-key -n MouseDown2Pane run "tmux set-buffer \"$(xclip -o -sel primary)\"; tmux paste-buffer"
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -sel primary -i"
set -g set-clipboard external

Upvotes: 4

meuh
meuh

Reputation: 12255

If you run tmux list-keys you should see lines like

bind-key    -T root         MouseDrag1Pane ...

depending on your version of tmux. You can add lines to your config file to unbind the ones you don't want, eg:

unbind-key -T root MouseDrag1Pane

Upvotes: 1

Related Questions