Skip to content

Commit 4ac8ccc

Browse files
committed
added @mighty-scroll-show-indicator option
fixes #5
1 parent 3661874 commit 4ac8ccc

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ $ tmux source ~/.tmux.conf
6464
|`@mighty-scroll-by-page`|`'irssi vi'`|List|Space separated list of processes that will be scrolled by page.|
6565
|`@mighty-scroll-pass-through`|`'vim nvim'`|List|Space separated list of processes that will receive mouse scroll events as is.|
6666
|`@mighty-scroll-fallback-mode`|`'history'`|`'history'`, `'by-line'`, `'by-page'`|Scroll mode when in alternate screen but the process didn't match `by-line` and `by-page` lists from above.|
67+
|`@mighty-scroll-show-indicator`|`off`|`on`, `off`|If enabled, shows the position indicator in the top right with current position and the number of lines in the history.|
6768

6869
Scrolling modes:
6970

mighty-scroll.tmux

+7
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,16 @@ else
2929
set_tmux_environment "MIGHTY_SCROLL_SELECT_PANE" "false"
3030
fi
3131

32+
if [ "$(get_tmux_option "$show_indicator_option" "$show_indicator_default")" = "on" ]; then
33+
show_indicator_arg=''
34+
else
35+
show_indicator_arg='-H'
36+
fi
37+
3238
# FIXME: move to tmux.conf after https://github.com/tmux/tmux/issues/3791
3339
tmux set-option -g command-alias[630] mighty_scroll_select_pane='if-shell "$MIGHTY_SCROLL_SELECT_PANE" {select-pane -t "{mouse}"}'
3440
tmux set-option -g command-alias[631] mighty_scroll_with_interval='send-keys -t "{mouse}" -N $MIGHTY_SCROLL_INTERVAL'
3541
tmux set-option -g command-alias[632] mighty_scroll_exit_mode_if_bottom='if-shell -F -t "{mouse}" "#{&&:#{pane_in_mode},#{==:#{scroll_position},0}}" {send-keys -t "{mouse}" -X cancel}'
42+
tmux set-option -g command-alias[633] mighty_scroll_enter_copy_mode="copy-mode $show_indicator_arg -t '{mouse}'"
3643

3744
tmux source-file "$CURRENT_DIR/tmux.conf"

scripts/variables.sh

+3
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ pass_through_default="vim nvim"
1515

1616
fallback_mode_option="@mighty-scroll-fallback-mode"
1717
fallback_mode_default="history"
18+
19+
show_indicator_option="@mighty-scroll-show-indicator"
20+
show_indicator_default="off"

tmux.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ bind-key -T root WheelUpPane {
99
if-shell -t "{mouse}" "$PSCHECK #{pane_pid} $MIGHTY_SCROLL_BY_PAGE || ( [ '$MIGHTY_SCROLL_FALLBACK_MODE' = 'by-page' ] && #{?alternate_on,true,false} )" {
1010
send-keys -t "{mouse}" PageUp
1111
} {
12-
copy-mode -t "{mouse}"
12+
mighty_scroll_enter_copy_mode
1313
mighty_scroll_with_interval -X scroll-up
1414
}
1515
}

0 commit comments

Comments
 (0)