NHDaly / tmux-better-mouse-mode

A tmux plugin to better manage and configure the mouse.
MIT License
916 stars 27 forks source link

Tmux Better Mouse Mode

A tmux plugin to better manage the mouse.

Provides options to control mouse behavior in tmux, so it will behave exactly how you want:

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.

Requirements

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

Key bindings

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.

Installation with Tmux Plugin Manager (recommended)

  1. Add this plugin to the list of TPM plugins in .tmux.conf:

    set -g @plugin 'nhdaly/tmux-better-mouse-mode'
  2. 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.

  3. To enable mouse-mode in tmux 2.1+, put the following line in your .tmux.conf:

    set-option -g mouse on

Manual Installation

  1. Clone the repo:

    $ git clone https://github.com/nhdaly/tmux-better-mouse-mode ~/clone/path
  2. Add this line to the bottom of .tmux.conf:

    run-shell ~/clone/path/scroll_copy_mode.tmux
  3. Reload TMUX environment:

    # type this in terminal
    $ tmux source-file ~/.tmux.conf

You should now be able to use the plugin.

Configuration

Set these options in .tmux.conf. For example, set -g @scroll-down-exit-copy-mode "off" to disable scrolling down exits copy-mode.

Contributions

@nhdaly @corv89 @pallxk @hughdavenport @giddie @pochemuto @zeorin @alcesleo @iamjamestl

Inspiration

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/

License

MIT