Repository navigation
Follow vim-fugitive's flows in diff and merge views - #32
Open
CoreyKaylor wants to merge 1 commit into
Open
CoreyKaylor wants to merge 1 commit into
CoreyKaylor wants to merge 1 commit into
Conversation
CoreyKaylor
force-pushed
the
fugitive-support
branch
from
November 6, 2026 13:11
81f4577 to
30bbe31
Compare
Merge and repository diff views now follow the quickfix list, so :cnext and :cprev move them in place from any pane. There is no event for these jumps, and one within a file changes no buffer, so host/quickfix compares the list position on SafeState. Merge selects the Nth conflict for a file's Nth entry, because entry lines count marker lines the result lacks. Diff views use the line number. Entries from :Git difftool [range] and :Gclog move the view to the comparison or commit they describe. Git commands now work from fugitive's buffers instead of failing on the fugitive:// name, and in the status buffer they use the line under the cursor. Everything that reads fugitive's formats is in git/fugitive. fugitive.auto_open, off by default, opens DiffBandit from :Git mergetool, :Git difftool, and dd in the status buffer. Three bugs fixed on the way do not need fugitive. Closing an untouched merge left base text in an already open buffer, so :wall replaced the conflicted file; it is now restored, and edits are kept per file. Leaving a file wiped its buffer, which broke quickfix entries with E92; existing buffers now stay with their owner, and DiffBandit's own are unloaded instead. A jump from a diff view's left pane wiped its scratch buffer and ended the session. Tests run against real vim-fugitive, pinned in tests/deps.sh. Fixes #31
CoreyKaylor
force-pushed
the
fugitive-support
branch
from
November 9, 2026 14:59
30bbe31 to
8a9758b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #31.
Problem
Asked in a comment on #1: can you walk fugitive's
:Git mergetoollist through:DiffBanditMergewith:cnextand:cprev? You couldn't, and trying could overwrite conflicted files with base text. #31 lists the rest of the gaps.What changes
Quickfix following. Merge and repository diff views follow the list in place, from any pane or the quickfix window. Neovim has no event for these jumps, and one within a file changes no buffer, so
host/quickfixcompares the list position onSafeState. It restores the panes and the view switches files. Plain:DiffBanditdiffs don't follow.Comparisons and commits. Fugitive's list context records both sides of each entry, and those map onto DiffBandit's modes:
:Git difftoolunstaged:Git difftool --cachedstaged:Git difftool <commit>allagainst that commit:Git difftool A B,A..B,A...Brev, read-only:Gclog,:0Gclog,-LFugitive's buffers. Git commands no longer fail on
fugitive://names, including in linked worktrees and submodules. In the status buffer they use the file or commit under the cursor and its section.fugitive.auto_open. Off by default.trueenables everything, or{ mergetool = true, difftool = true, dd = true }picks. On lines with no file,ddruns fugitive's own mapping.Fixes that don't need fugitive
:wallreplaced the conflicted file. The buffer is now restored, including its unsaved changes and cursor. Edits are kept per file and resume on return.E92. Existing buffers now stay with their owner, and DiffBandit's own are unloaded instead of wiped.Worth a close look
--stagedwins when a view opens, but the first jump adopts the list's comparison.git/fugitiveandgit/fugitive_autoread its status lines, list context and event name. Unknown shapes fall back to plain behavior. The pin won't catch format changes until it's bumped.:editon the current entry's file counts as a jump, because it looks the same as:cc.Known limits
:Git difftool --cached <commit>with a commit other thanHEADkeeps the view's comparison, becausestagedonly compares againstHEAD.:DiffBanditGitCurrenton:Gedit HEAD~1:a.txtshows the file's current changes, not that revision.:Gdiffsplitand:Git difftool -ystill use vimdiff.savedrather thanmodified. The panel's switching already behaved this way, but following makes it easier to see.:DiffBanditMergeinside a merge tab still opens another tab.Testing
nvim -l tests/run_all.lua: all 23 jobs pass on three local runs, andtests/smoke/tmux.shpasses. CI passes on Linux too, including the fugitive tests. It now also fetches fugitive at a pinned commit throughtests/deps.sh.test_fugitive_merge.luaandtest_fugitive_diff.luadrive real vim-fugitive rather than a simulated list. Most of them fail against the code from before each change. The rest pass there by design, because they check that something stays unchanged.auto_open. Those were one-off runs on macOS with Neovim 0.12.6, and I didn't try the Kitty connector.