From eca58c09f82f6bc1cc808aba145dc81caabd1b9c Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Thu, 8 Sep 2022 16:35:24 +0200 Subject: [PATCH] tmux: Scroll only 5 lines when entering copy-mode Only scroll 5 lines instead of a full page when entering copy-mode through the wheel as a full page was too disorienting. TODO: Pass `WheelUpPane` after entering copy-mode instead of redundantly executing it's bound command. Somehow neither of the following worked: send -XM WheelUpPane send -X WheelUpPane --- .config/tmux/tmux.conf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index 0b85762..5443a67 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -11,10 +11,12 @@ bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-no-clear "xclip -se p" # https://github.com/neovim/neovim/wiki/FAQ#cursor-shape-doesnt-change-in-tmux set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q' -# Scroll up one page when entering copy-mode through the mouse wheel. Also +# Scroll up 5 lines when entering copy-mode through the mouse wheel. Also # discard the `-e` flag passed to copy-mode from the default binding (See below) bind -n WheelUpPane \ - if -F "#{||:#{pane_in_mode},#{mouse_any_flag}}" { send -M } { copy-mode -u } + if -F "#{||:#{pane_in_mode},#{mouse_any_flag}}" \ + { send -M } \ + { copy-mode; send -XN5 scroll-up } # Scroll without selecting the pane bind -T copy-mode-vi WheelUpPane send -XN5 scroll-up # Exit copy-mode when at the bottom. This practically mimics `copy-mode -e` but