Skip to content

EXC-1934 Toggle between unified and side-by-side diff - #40

Closed
macintacos wants to merge 7 commits into
mainfrom
EXC-1934/side-by-side-diff
Closed

macintacos wants to merge 7 commits into
mainfrom
EXC-1934/side-by-side-diff

Conversation

@macintacos

Copy link
Copy Markdown
Owner

Part of: EXC-1934

Change Kind: new feature

What changed

The diff can now be drawn side by side as well as unified. :Changeset diff split (<C-g>D, <Plug>(changeset-diff-split)) switches the whole branch between the two views for the session, and the new unified_diff.view option picks the view a session starts in, unified when unset. Vim's diff mode belongs to the tabpage, so only the window you are reading gets the base | file pair, and every other window there stays unified. Files new since the base, files gitsigns is still comparing against the index, and tabpages holding a diff of your own also stay unified.

What to test

  • With the sidebar open, press <C-g>D: the window you are reading gets its base in a window on its left, both in diff mode, and messages say "side-by-side diff on". Press it again to go back to unified.
  • Hold j in the sidebar in split mode: the base window follows the preview without opening and closing a window per row, and q leaves no base window or stray 'diff' behind.
  • Move between two file windows: the pair follows the cursor, and the window it leaves gets its unified view back.
  • Run your own :diffsplit or :Gitsigns diffthis on a file the pair covered earlier: changeset leaves your diff alone.

- unified_diff.view picks "unified" or "split"; split puts the base
  beside each tabpage's reading window, the two in diff mode
- new split_diff module owns the base windows
- previews and entering a file window move the pair
- a preview swap parks the base window for the next listed file
- turning off closes every base window no view names
- scrub a 'diff' that comes back with its buffer
- closing a file window takes its base window with it
- a restored session drops its empty gitsigns:// windows
- :Changeset diff split, <Plug>(changeset-diff-split) and <C-g>D
  switch the view for the session, turning the diff on when off
- messages name the active view; the gitsigns warning and
  :checkhealth now say "the diff"
- the reading window is never a floating window
- scrub forgets a buffer once its 'diff' is known off, leaving the
  user's own diffs alone
- closing a file window alone with its base window no longer aborts
  with E855; the base window closes just after
- session restore resets a leftover foldmethod=diff
- a file compared against the index stays unified: its base buffer
  writes back to the index
- :Changeset diff split from off turns the diff on side by side
- one named rule says when a parked base window lives
@linear-code

linear-code Bot commented Oct 12, 2026

Copy link
Copy Markdown

EXC-1934

@macintacos macintacos closed this Oct 12, 2026
@macintacos
macintacos deleted the EXC-1934/side-by-side-diff branch October 12, 2026 02:38
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.

1 participant