From fea0775cabf07e31ca4439fc5e2b363c025e1af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20La=C3=ADn?= Date: Tue, 13 Aug 2024 12:41:59 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(nvim):=20new=20extra:=20gitgra?= =?UTF-8?q?ph.nvim?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/extras/editor/git/gitgraph.lua | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .config/nvim/lua/plugins/extras/editor/git/gitgraph.lua diff --git a/.config/nvim/lua/plugins/extras/editor/git/gitgraph.lua b/.config/nvim/lua/plugins/extras/editor/git/gitgraph.lua new file mode 100644 index 00000000..ab73461e --- /dev/null +++ b/.config/nvim/lua/plugins/extras/editor/git/gitgraph.lua @@ -0,0 +1,40 @@ +return { + "isakbm/gitgraph.nvim", + opts = { + symbols = { + merge_commit = "", + commit = "", + }, + format = { + timestamp = "%H:%M:%S %d-%m-%Y", + fields = { "hash", "timestamp", "author", "branch_name", "tag" }, + }, + hooks = { + on_select_commit = function(commit) + if LazyVim.has("diffview.nvim") then + vim.notify("DiffviewOpen " .. commit.hash .. "^!") + vim.cmd(":DiffviewOpen " .. commit.hash .. "^!") + else + print("selected commit:", commit.hash) + end + end, + on_select_range_commit = function(from, to) + if LazyVim.has("diffview.nvim") then + vim.notify("DiffviewOpen " .. from.hash .. "~1.." .. to.hash) + vim.cmd(":DiffviewOpen " .. from.hash .. "~1.." .. to.hash) + else + print("selected range:", from.hash, to.hash) + end + end, + }, + }, + keys = { + { + "gl", + function() + require("gitgraph").draw({}, { all = true, max_count = 5000 }) + end, + desc = "Graph", + }, + }, +}