feat(git): add git module and replace vim-flog with :Glog

This commit is contained in:
2026-04-13 21:40:52 +02:00
parent 144b2ffd43
commit 959cec7051
8 changed files with 337 additions and 24 deletions
+3
View File
@@ -21,6 +21,9 @@ local highlights = {
DiffAdd = { bg = "#1a2f22" },
DiffChange = { bg = "#15304a" },
DiffDelete = { bg = "#311c1e" },
GitDeleted = { fg = c.red },
GitDirty = { fg = c.yellow },
GitNew = { fg = c.green },
}
require("onedark").set_options("highlights", highlights)
require("onedark").load()
-1
View File
@@ -1 +0,0 @@
vim.keymap.set("n", "<leader>gl", vim.cmd.Flog)
+14 -1
View File
@@ -30,6 +30,17 @@ local function toggle_git_status()
open_git_status()
end
vim.api.nvim_create_user_command("Glog", function(opts)
local mods = opts.mods ~= "" and (opts.mods .. " ") or ""
vim.cmd(
mods
.. "Git log --graph --all --decorate --date=short "
.. "--format=format:'%h %ad {%an}%d %s' "
.. opts.args
)
end, { nargs = "*", desc = "Pretty git log via fugitive" })
vim.keymap.set("n", "<leader>gl", vim.cmd.Glog)
vim.keymap.set("n", "<leader>gd", vim.cmd.Gvdiffsplit)
vim.keymap.set("n", "<leader>gD", function() vim.cmd.Gvdiffsplit("HEAD") end)
vim.keymap.set("n", "<leader>gh", vim.cmd.Ghdiffsplit)
@@ -39,7 +50,9 @@ vim.keymap.set("n", "<leader>ga", function() vim.cmd.G("commit --amend") end)
vim.keymap.set("n", "<leader>gp", function() vim.cmd.G("push") end)
vim.keymap.set("n", "<leader>gg", toggle_git_status)
vim.api.nvim_create_autocmd("BufWritePost", {
vim.api.nvim_create_autocmd("User", {
pattern = "GitRefresh",
group = vim.api.nvim_create_augroup("ow.fugitive", { clear = true }),
callback = function()
vim.fn["fugitive#ReloadStatus"]()
end,