diff --git a/tmux.conf b/tmux.conf index ff21d48..dd9b354 100644 --- a/tmux.conf +++ b/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 \