Skip to content

feat(ui): add compact mode to fold unchanged regions in diff view#344

Open
fredrikaverpil wants to merge 1 commit intoesmuellert:mainfrom
fredrikaverpil:feat/compact-mode
Open

feat(ui): add compact mode to fold unchanged regions in diff view#344
fredrikaverpil wants to merge 1 commit intoesmuellert:mainfrom
fredrikaverpil:feat/compact-mode

Conversation

@fredrikaverpil
Copy link
Contributor

@fredrikaverpil fredrikaverpil commented Mar 25, 2026

Why?

Reviewing files with scattered changes requires scrolling through large unchanged regions. A compact view that shows only hunks + context lines (like git diff output) makes it much easier to focus on what changed.

What?

  • New compact.lua module using foldmethod=expr to fold unchanged regions
  • Toggle with gc keymap, works in both side-by-side and inline layouts
  • Saves/restores user's original fold state (foldmethod, foldexpr, foldlevel, etc.)
  • Configurable context lines via diff.compact_context_lines (default 3)
  • Integrates with auto-refresh (folds update when buffer changes) and layout toggle (compact persists across t)
  • Added to g? help menu and README (also ticked the roadmap checkbox)

Notes

Toggle with `gc` to fold away unchanged code, showing only hunks plus
configurable context lines (default 3). Works in both side-by-side and
inline layouts. Saves and restores the user's original fold state when
toggling off. Integrates with auto-refresh and layout toggle.
@fredrikaverpil fredrikaverpil marked this pull request as ready for review March 25, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: fold non relevent sections for huge files in file history commit view

1 participant