From 764bc6d9b74165b55c33eb63be1580b356af4186 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Mon, 19 Sep 2022 13:07:35 +0200 Subject: [PATCH] tmux: Send 5x`up` when scrolling in alternate mode --- .config/tmux/tmux.conf | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index cccc205..2006665 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -15,12 +15,19 @@ 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 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) +# Scroll up 5 lines when entering copy-mode through the mouse wheel, send 5x`up` +# when the current pane is in alternate mode and 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; send -XN5 scroll-up } + if -F "#{||:#{pane_in_mode},#{mouse_any_flag}}" { + send -M + } { + if -F "#{alternate_on}" { + send -N5 up + } { + 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