What do you want to change?
Add a scrolloff-style setting (a la Vim's scrolloff) that keeps the cursor/current-hunk line a fixed number of rows away from the top/bottom of the viewport while scrolling through a diff, instead of letting it reach the very edge before the view scrolls.
Why?
When reviewing large diffs, scrolling currently lets the focused line travel all the way to the top or bottom edge of the pane before the viewport moves, so the surrounding context disappears right when it's most useful. Keeping a configurable margin (or fully centering the line) would make it much easier to see the code above/below the change while navigating hunk-by-hunk or line-by-line — same rationale as scrolloff in Vim/Neovim.
I checked and there's currently no CLI flag or config file (~/.config/hunk/) exposing anything like this — hunk diff --help / hunk show --help have --mode, --wrap, --line-numbers, --hunk-headers, --agent-notes, --theme, --transparent-bg, --watch, but nothing for scroll margin/centering.
How? (optional)
A numeric config option (e.g. scroll_off = 5) or CLI flag (--scroll-off <n>), with a special value (or a separate --center-cursor flag) for "always keep centered." Could default to 0 (today's behavior) to stay backward compatible.
I'm happy to implement this myself once the approach is agreed — flagging as a proposal first per CONTRIBUTING.md, since it's a new configuration option.
Version: 0.17.7 (npm hunkdiff)
What do you want to change?
Add a
scrolloff-style setting (a la Vim'sscrolloff) that keeps the cursor/current-hunk line a fixed number of rows away from the top/bottom of the viewport while scrolling through a diff, instead of letting it reach the very edge before the view scrolls.Why?
When reviewing large diffs, scrolling currently lets the focused line travel all the way to the top or bottom edge of the pane before the viewport moves, so the surrounding context disappears right when it's most useful. Keeping a configurable margin (or fully centering the line) would make it much easier to see the code above/below the change while navigating hunk-by-hunk or line-by-line — same rationale as
scrolloffin Vim/Neovim.I checked and there's currently no CLI flag or config file (
~/.config/hunk/) exposing anything like this —hunk diff --help/hunk show --helphave--mode,--wrap,--line-numbers,--hunk-headers,--agent-notes,--theme,--transparent-bg,--watch, but nothing for scroll margin/centering.How? (optional)
A numeric config option (e.g.
scroll_off = 5) or CLI flag (--scroll-off <n>), with a special value (or a separate--center-cursorflag) for "always keep centered." Could default to0(today's behavior) to stay backward compatible.I'm happy to implement this myself once the approach is agreed — flagging as a proposal first per CONTRIBUTING.md, since it's a new configuration option.
Version: 0.17.7 (npm
hunkdiff)