NHDaly / tmux-better-mouse-mode

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

Scroll more if Control is pressed #24

Open alexcastano opened 7 years ago

alexcastano commented 7 years ago

I think a cool feature could be if the Control key (or other modifier key) is pressed, the number of lines scrolled are different. For example, if control is pressed 30 lines are scrolled. This can be done with a multiplier (x10) or just another scroll speed variable.

Thank you for your time :)

NHDaly commented 7 years ago

Yeah that's a pretty cool idea! I probably won't get to this any time soon, but if anyone wants to send a PR that would be awesome! :D

NHDaly commented 7 years ago

Oh cool! I don't know if this existed last year, but it seems really easy now! You just need to add the C- prefix to do a ctrl modifier, and S- prefix to do a shift modifier.

So to do what you asked:

bind-key -T copy-mode    C-WheelUpPane         send-keys -X -N 30 scroll-up
bind-key -T copy-mode-vi C-WheelUpPane         send-keys -X -N 30 scroll-up
bind-key -T copy-mode    C-WheelDownPane         send-keys -X -N 30 scroll-down
bind-key -T copy-mode-vi C-WheelDownPane         send-keys -X -N 30 scroll-down

# This is the ugly one built programmatically from the script. Just have to copy/paste it unfortunately:
bind-key -T root C-WheelUpPane      if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "         if -Ft= '#{alternate_on}'           \"send-keys -t= up ; \"           \"                          if -Ft= '#{pane_in_mode}'               'send-keys -M ; '               'copy-mode -e ; send-keys -M ; '           \"       "

Cool idea! :)

eMPee584 commented 7 years ago

Mhh couldn't a distinct factor for each modifier key be used in get_repeated_scroll_cmd(), i.e. CTRL to speed up, SHIFT to slow down...?

NHDaly commented 7 years ago

Yeah totally. Do we think that's a thing people would want to use?

We could add it to the plugin if so. Should we just add a boolean option to enable/disable the speed-modifiers? Or add an option to specify the mapping for fast/slow scroll?

I'm interested in others' input here on what would be useful.