A tmux plugin to better manage the mouse.
Provides options to control mouse behavior in tmux, so it will behave exactly how you want:
less
that don't provide built in mouse support. copy-mode
and return to your prompt by scrolling back all the way down to the bottom.Finally, tmux
version 2.1 introduced backwards-incompatible changes to the mouse behavior, and this plugin restores the old mouse behavior. tmux
version 2.2 mostly restores the 2.0 mouse behavior, but this plugin improves tmux mouse mode beyond those changes and provides you with more control.
This plugin is intended for tmux
version 2.1 and higher. It does not work for 2.0 or below.
NOTE: This plugin provides options to change the mouse-mode behavior, but does not enable mouse-mode.
To enable mouse-mode in tmux 2.1+, put the following line in your ~/.tmux.conf
:
set-option -g mouse on
This plugin will overwrite the values for WheelUpPane
and WheelDownPane
in tmux in order to configure mouse scrolling.
To see your current setting for these variables, check the output of tmux list-keys -T root
.
Add this plugin to the list of TPM plugins in .tmux.conf
:
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
Press prefix
+ I or run $TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh
to fetch the plugin and source it. You should now be able to
use the plugin.
To enable mouse-mode in tmux 2.1+, put the following line in your .tmux.conf
:
set-option -g mouse on
Clone the repo:
$ git clone https://github.com/nhdaly/tmux-better-mouse-mode ~/clone/path
Add this line to the bottom of .tmux.conf
:
run-shell ~/clone/path/scroll_copy_mode.tmux
Reload TMUX environment:
# type this in terminal
$ tmux source-file ~/.tmux.conf
You should now be able to use the plugin.
Set these options in .tmux.conf
. For example, set -g @scroll-down-exit-copy-mode "off"
to disable scrolling down exits copy-mode.
scroll-down-exit-copy-mode
- When enabled, the pane exits copy-mode
when scrolling hits the bottom of the scroll-back history.
copy-mode
.copy-mode
.scroll-without-changing-pane
- When enabled, scrolling the mouse will not select the moused-over pane, allowing you to scroll a window just to read previous output and then keep typing in the current pane. Enabling this feature is a change from tmux 2.0
settings, but may be an improvement.
scroll-in-moused-over-pane
- When enabled, scrolling with your mouse over a pane will perform the scroll in that pane, instead of the currently selected one. If scroll-without-changing-pane
is set to "off"
, this will also select the moused-over pane.
scroll-speed-num-lines-per-scroll
- Sets the number of lines to scroll per mouse wheel scroll event. The default option is 3, which was the scroll speed in tmux 2.0
. Larger numbers scroll faster. To slow down scrolling to slower than one line per wheel click, set the value to a decimal between 0.0 and 1.0. With a decimal value, only that fraction of wheel events will take effect. The value must be > 0. Examples:
emulate-scroll-for-no-mouse-alternate-buffer
- When enabled, tmux will emulate scrolling for "full-screen", alternate buffer programs, such as less
, man
, or vi
that don't themselves already support mouse interactions. It will not enter copy-mode
and will not scroll through pane output history, but will instead send <up-arrow>
(↑) and <down-arrow>
(↓) keys to the application. The scroll speed is also set by @scroll-speed-num-lines-per-scroll
above.
This option defaults to "off", which matches the behavior in tmux 2.0
. Note, though, that this default behavior may be undesirable since the pane history gets munged when entering a full-screen alternate buffer program. It's a pretty great option is all I'm saying.
@nhdaly @corv89 @pallxk @hughdavenport @giddie @pochemuto @zeorin @alcesleo @iamjamestl
Inspired by David Verhasselt's in depth article on Tmux 2.1's changes to Mouse support and scrolling: http://www.davidverhasselt.com/better-mouse-scrolling-in-tmux/