feat(git): replace vim-fugitive with custom git module

This commit is contained in:
2026-04-27 12:41:38 +02:00
parent 5a3e39574d
commit f55d7ac11d
13 changed files with 837 additions and 145 deletions
+17
View File
@@ -0,0 +1,17 @@
-- The built-in `git` filetype is reused for our `:G show` / `:G cat-file -p`
-- output buffers and for commits opened from the log window. We set
-- `vim.b.git_worktree` before assigning the filetype on those buffers; the
-- guard below keeps the <CR> dispatcher off any unrelated git buffer (a
-- real `.git/HEAD` file, etc.) so the default normal-mode <CR> still works.
if not vim.b.git_worktree then
return
end
local cr = vim.api.nvim_replace_termcodes("<CR>", true, false, true)
vim.keymap.set("n", "<CR>", function()
if not require("git.show").open_at_cursor() then
-- "n" mode = no remap, so this doesn't recurse into our mapping.
vim.api.nvim_feedkeys(cr, "n", false)
end
end, { buffer = 0, silent = true, desc = "Open file at commit" })