It seems that mouse support changed in one of the recent versions of tmux and every article I am finding on the subject uses outdated settings. All I want to be able to do is use my mouse to scroll when in scroll mode and use it to copy/paste with the left button like it usually does in a terminal. Unfortunately, if I set set -g mouse on
the copy/paste doesn't work and if I set it to off, scroll doesn't work. I am on OSX 10.12 Sierra if that makes a difference and I am using the default Terminal app.
In my case fn button + mouse works fine for text selection. After selection need to press cmd+c for copying and paste with cmd+v.
One quick way to get copy-paste functionality back using the mouse is to disable "Mouse Reporting"; see the menu item View > Allow Mouse Reporting
in Terminal.app. The default keyboard shortcut is ⌘ Command+r, so a possible workflow is:
Alternatively, hold down the fn key to temporarily obtain the same functionality, as noted in the answer from @yaroslavpalamar.
The comments pointed to an issue with this solution when using multiple panes. This requires a fix from within tmux, in order to simultaneously zoom the pane and allow copy/paste with the mouse. To do that, we can augment the solution pointed to by @MadWombat by adding the line below to the config.
In your ~/.tmux.conf
file (or /etc/tmux.conf
):
bind-key m set mouse \; resize-pane -Z
Then prefix+m is a toggle: hit it once to zoom the pane and allow copy/paste with the mouse, hit it again regain the former functionality. Note this works fine with a single pane as well -- the zoom part of the command has no effect in that case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With