Requires tmux 2.1 or greater. Find your tmux version with
tmux -V
. If need be, it's quite easy compiling tmux.
A quite recent, easy to miss improvement to tmux is the ability to define a custom behavior for mouse release while in copy-mode.
Copy-mode is this temporary mode you activate (default key bindings) with Ctrl-b + [
and exit from with Ctrl-b + ]
. While in copy-mode, you may scroll up and down. You may also enter copy mode directly by scrolling up if you've activated mode-mouse
and the proper settings on tmux < 2.1, or if you are using the scroll-copy-mode plugin on tmux 2.1+).
While in copy-mode, if you ever click or highlight and release text, tmux will by default exit from copy-mode, and scroll down back to the prompt. I find this behavior to be very annoying, for I mostly highlight text to help me think through a problem, or to showcase something to someone while pairing; so do some other folks. I'd much rather decide when I want to actually exit from copy-mode and, maybe, paste what I've just selected. YMMV :)
A new setting was introduced in tmux that lets you prevent tmux from scrolling back to normal-mode
on mouse release. Refer to the .tmux.conf snippet for details. Thank tmux!
Note: The overall workflow is not perfect though, for if you are in normal-mode (that is, caret is blinking in the prompt) and highlight some text then release, tmux will enter copy-mode as expected but will not leave it to go back to normal-mode, which means you have to press either a key binding or q
/Enter
to be able to type again (and, maybe, paste your last selection). I can sure live with that just fine, but if you agree going back to normal-mode right away in that case would be the best/least-surprising workflow, feel free to hop on tmux/tmux#337.