1
0
Fork 0

git-worktree & gitgraph

This commit is contained in:
zymon 2024-08-27 17:25:32 +02:00
parent 3f32cc9263
commit fe3b194093

View file

@ -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 = {
{
"<leader>gl",
function()
require("gitgraph").draw({}, { all = true, max_count = 5000 })
end,
desc = "GitGraph - Draw",
},
},
},
}