diff --git a/lua/znvim/plugins/git.lua b/lua/znvim/plugins/git.lua index e23ee9d..213eb38 100644 --- a/lua/znvim/plugins/git.lua +++ b/lua/znvim/plugins/git.lua @@ -60,4 +60,53 @@ return { }, }, + { -- git-worktree + "https://github.com/polarmutex/git-worktree.nvim", + event = "BufReadPre", + dependencies = { + "https://github.com/nvim-lua/plenary.nvim", + "https://github.com/nvim-telescope/telescope.nvim", + }, + config = function () + require("telescope").load_extension("git_worktree") + end + }, + { -- gitgraph + "https://github.com/isakbm/gitgraph.nvim", + event = "BufReadPre", + dependencies = { + "https://github.com/sindrets/diffview.nvim", + }, + opts = { + symbols = { + merge_commit = 'M', + commit = '*', + }, + format = { + timestamp = '%H:%M:%S %d-%m-%Y', + fields = { 'hash', 'timestamp', 'author', 'branch_name', 'tag' }, + }, + hooks = { + -- Check diff of a commit + on_select_commit = function(commit) + vim.notify("DiffviewOpen " .. commit.hash .. '^!') + vim.cmd(":DiffviewOpen " .. commit.hash .. '^!') + end, + -- Check diff from commit a -> commit b + on_select_range_commit = function(from, to) + vim.notify("DiffviewOpen " .. from.hash .. '~1..' .. to.hash) + vim.cmd(":DiffviewOpen " .. from.hash .. '~1..' .. to.hash) + end, + }, + }, + keys = { + { + "gl", + function() + require("gitgraph").draw({}, { all = true, max_count = 5000 }) + end, + desc = "GitGraph - Draw", + }, + }, + }, }