refactor(git): centralize registrations, defer submodule loads

This commit is contained in:
2026-04-30 16:23:18 +02:00
parent bf9cc73626
commit 8e6b13a7a3
7 changed files with 131 additions and 151 deletions
-31
View File
@@ -326,35 +326,4 @@ function M.rev_parse(worktree, rev, short)
return trimmed ~= "" and trimmed or nil
end
function M.setup()
local group = vim.api.nvim_create_augroup("ow.git.repo", { clear = true })
vim.api.nvim_create_autocmd(
{ "BufReadPost", "BufNewFile", "BufWritePost", "FileChangedShellPost" },
{
group = group,
callback = function(args)
M.refresh_buf(args.buf)
end,
}
)
vim.api.nvim_create_autocmd({ "BufDelete", "BufWipeout" }, {
group = group,
callback = function(args)
M.unregister(args.buf)
end,
})
vim.api.nvim_create_autocmd("FocusGained", {
group = group,
callback = function()
M.refresh_buf(vim.api.nvim_get_current_buf())
end,
})
vim.api.nvim_create_autocmd("VimLeavePre", {
group = group,
callback = function()
M.stop_all()
end,
})
end
return M