Configure tmux scroll speed

David Winiecki picture David Winiecki · Mar 15, 2016 · Viewed 9.8k times · Source

Can tmux scroll speed (using a mouse wheel or touch pad) be configured?

Tmux 2.1 sort of broke scrolling (depending on your configuration), forcing me to update my config. I did that a few weeks ago.

But now I think tmux scrolls* slower than it used to. I think I read you can configure the scroll speed but I can't find any mention of that anywhere now.

* Scrolling with a mouse wheel that is. (I'm actually using a Macbook trackpad but I think it's equivalent to a mouse wheel.)

I know you can do 10C-u (with vi key bindings) to jump up 10 pages, but I'd also like to be able to just scroll fast with the mouse.

I think this is all the relevant config I personally have currently:

# Use the mouse to select panes, select windows (click window tabs), resize
# panes, and scroll in copy mode.
# Requires tmux version >= 2.1 (older versions have different option names for mouse)
set -g mouse on

# No need to enter copy-mode to start scrolling.
# From github.com/tmux/tmux/issues/145
# Requires tmux version >= 2.1 (older versions have different solutions)
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"

Answer

domi91c picture domi91c · May 22, 2016

Using the tmux-scroll-copy-mode plugin should help here.

Once you've installed it, just add set -g @scroll-speed-num-lines-per-scroll 5 to your .tmux.conf.

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 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 should be >= 0. Examples:

"3" (default) - Scroll three lines per every mouse wheel click. "1" - One line per mouse wheel scroll click (smoothest). "0.5" - Scroll one line only on every other mouse wheel scroll click. "0.25" - Scroll one line only on every fourth mouse wheel scroll click.