Repository navigation
Open git panel file diffs and commits as preview tabs #67009
kinoute
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Body
What are you proposing?
Preview tabs already cover files opened from the project panel, the file finder and multibuffers, each behind its own
preview_tabs.enable_preview_from_*setting. The git panel is left out: every file diff opened from the Changes tab and every commit opened from the History tab gets a regular tab.Proposal: open them as preview tabs, behind a new
preview_tabs.enable_preview_from_git_panelsetting,trueby default likeenable_preview_from_project_panel.Why does this matter?
Both tabs are mostly used to browse: going through the changed files one by one before a commit, or walking the history to find the commit that introduced something. Each click leaves a tab behind. Therefore, after reviewing ten files or scanning a few commits, the pane holds ten more tabs to close by hand, mixed with the files you were actually editing.
With preview tabs, the next diff or commit replaces the previous one. The one worth keeping becomes a regular tab the usual way: double click on the tab, pin it, or edit it.
Are there any examples or context?
VS Code does the same in its Source Control view: a single click on a changed file opens its diff as a preview editor, and a double click pins it. Files listed under a commit in the Source Control Graph follow the same rule.
It looks like this in Zed with my future PR:
Screenshot.2026-11-15.a.19.36.17.mov
Possible approach
I have a working implementation with tests in draft PR #67010. The rules it follows:
git_panel.entry_primary_click_action: "file_diff", oncmd-enter, or from "Open File Diff" in the context menu. A double click keeps the tab, as in the project panel. Opening several selected files at once never previews, since only the last one would survive.enteropens the commit as a preview, and a double click keeps it. Reopening a commit that is already open leaves it as it was: a preview stays a preview, a regular tab stays regular.Two points I'd like your opinion on:
entry_primary_click_actionis"project_diff". A single click opens the project diff, a singleton that this proposal leaves alone, so the double click is the only mouse path to a file diff. I kept that diff as a regular tab, since a double click means "keep" everywhere else, and I'd rather leave it that way. The cost: with the default settings, mouse users only see the change in the History tab. Previewing the double-click diff would fix that, at the price of a double click that means something different here.All reactions