Emulate mouse scrolling for alternate buffers
For pagers such as `less` which don't support terminal mouse features enable scrolling with the mouse wheel by emulating the behaviour using `send-keys -t= {up,down}` when in alternate (fullscreen) mode. These bindings retain the expected behaviour when using programs which do support terminal mouse events and copy-mode.
This commit is contained in:
parent
720271baa5
commit
b6ee1bb677
26
tmux.conf
26
tmux.conf
@ -80,6 +80,32 @@ bind C-u copy-mode -u
|
||||
# Begin selection in copy mode with v not Space
|
||||
bind -T copy-mode-vi v send-keys -X begin-selection
|
||||
|
||||
# Enable mouse scrolling up in alternate buffers.
|
||||
# If #{mouse_any_flag} is 1 the pane is running with mouse support, e.g. vim.
|
||||
# If #{alternate_on} is 1 the terminal is in alternate buffer mode, e.g. less.
|
||||
# If #{pane_in_mode} is 1 the pane is in copy-mode.
|
||||
bind -n WheelUpPane \
|
||||
if -Ft= "#{mouse_any_flag}" \
|
||||
"send-keys -M" \
|
||||
"if -Ft= \"#{alternate_on}\" \
|
||||
\"send-keys -t= Up ; \
|
||||
send-keys -t= Up ; \
|
||||
send-keys -t= Up ; \" \
|
||||
\"select-pane -t= ; \
|
||||
if -Ft= '#{pane_in_mode}' \
|
||||
'send-keys -M' \
|
||||
'copy-mode -e ; send-keys -M' \" "
|
||||
# Emulate mouse scrolling down in alternate buffers.
|
||||
bind -n WheelDownPane \
|
||||
if -Ft= "#{mouse_any_flag}" \
|
||||
"send-keys -M" \
|
||||
"if -Ft= \"#{alternate_on}\" \
|
||||
\"send-keys -t= Down ; \
|
||||
send-keys -t= Down ; \
|
||||
send-keys -t= Down ; \" \
|
||||
\"select-pane -t= ; \
|
||||
send-keys -M\" "
|
||||
|
||||
# Yank to the system clipboard in copy mode
|
||||
if -b '[ "`uname`" = "Darwin" ]' \
|
||||
'bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel \
|
||||
|
Loading…
x
Reference in New Issue
Block a user