feat(fugitive): add status buffer keymaps for unified diffs

Adds du/dU keymaps to fugitive's :Git status buffer for opening unified
diffs instead of side-by-side diffs:
- du opens horizontal split (mirrors dd)
- dU opens vertical split (mirrors dv)

Parses status buffer lines to extract filename and detect section
(staged/unstaged/untracked). For staged files, diffs index vs HEAD.
For unstaged files, diffs working tree vs index.

Configurable via vim.g.diffs.fugitive.horizontal/vertical (set to
false to disable).
This commit is contained in:
Barrett Ruth 2026-02-04 22:23:21 -05:00
parent ea60ab8d01
commit 9289f33639
3 changed files with 186 additions and 0 deletions

View file

@ -13,6 +13,13 @@ vim.api.nvim_create_autocmd('FileType', {
return
end
diffs.attach(args.buf)
if args.match == 'fugitive' then
local fugitive_config = diffs.get_fugitive_config()
if fugitive_config.horizontal or fugitive_config.vertical then
require('diffs.fugitive').setup_keymaps(args.buf, fugitive_config)
end
end
end,
})