diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua index 877f495..20a71f6 100644 --- a/nvim/lua/config/keymaps.lua +++ b/nvim/lua/config/keymaps.lua @@ -115,15 +115,22 @@ end require("which-key").add({ -- { "g", group = "Git" }, { "gvf", diffOpenFileHistory, desc = "Open DiffView on Files" }, - { "gt", command("DiffviewToggleFiles"), desc = "Open DiffView on Files" }, + { "gvt", command("DiffviewToggleFiles"), desc = "toggle diffviewfiles" }, + { "gvc", command("DiffviewClose"), desc = "Open DiffView on Files" }, + { + "gvh", + function() + print("gvf with . opens commit wise history of entire codebase.") + print("gvf with % opens commit wise history of current file.") + print("gvf with opens commit wise history of that file.") + print("gvo with HEAD opens diff of latest commit.") + print("gvo with HEAD~3 opens diff of last 3 commits.") + print("gvo with master..HEAD opens changes of your feature branch.") + end, + desc = "gvo help", + }, { "gvo", diffOpenWithInput, desc = "Open DiffView" }, }) --- diffOpenFileHistory with . opens commit wise history of entire codebase. --- diffOpenFileHistory with % opens commit wise history of current file. --- diffOpenFileHistory with opens commit wise history of that file. --- diffOpenWithInput with HEAD opens diff of latest commit. --- diffOpenWithInput with HEAD~3 opens diff of last 3 commits. --- diffOpenWithInput with master..HEAD opens changes of your feature branch. -- -- vim.api.nvim_set_keymap("c", "", "", { noremap = true, silent = true }) diff --git a/nvim/lua/plugins/plugins.lua b/nvim/lua/plugins/plugins.lua index 0512d89..fe6812e 100644 --- a/nvim/lua/plugins/plugins.lua +++ b/nvim/lua/plugins/plugins.lua @@ -482,61 +482,4 @@ return { "sindrets/diffview.nvim", opts = {}, }, - { - "lewis6991/gitsigns.nvim", - event = "LazyFile", - opts = { - signs = { - add = { text = "▎" }, - change = { text = "▎" }, - delete = { text = "" }, - topdelete = { text = "" }, - changedelete = { text = "▎" }, - untracked = { text = "▎" }, - }, - signs_staged = { - add = { text = "▎" }, - change = { text = "▎" }, - delete = { text = "" }, - topdelete = { text = "" }, - changedelete = { text = "▎" }, - }, - on_attach = function(buffer) - local gs = package.loaded.gitsigns - - local function map(mode, l, r, desc) - vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) - end - - -- stylua: ignore start - map("n", "]h", function() - if vim.wo.diff then - vim.cmd.normal({ "]c", bang = true }) - else - gs.nav_hunk("next") - end - end, "Next Hunk") - map("n", "[h", function() - if vim.wo.diff then - vim.cmd.normal({ "[c", bang = true }) - else - gs.nav_hunk("prev") - end - end, "Prev Hunk") - map("n", "]H", function() gs.nav_hunk("last") end, "Last Hunk") - map("n", "[H", function() gs.nav_hunk("first") end, "First Hunk") - map({ "n", "v" }, "ghs", ":Gitsigns stage_hunk", "Stage Hunk") - map({ "n", "v" }, "ghr", ":Gitsigns reset_hunk", "Reset Hunk") - map("n", "ghS", gs.stage_buffer, "Stage Buffer") - map("n", "ghu", gs.undo_stage_hunk, "Undo Stage Hunk") - map("n", "ghR", gs.reset_buffer, "Reset Buffer") - map("n", "ghp", gs.preview_hunk_inline, "Preview Hunk Inline") - map("n", "ghb", function() gs.blame_line({ full = true }) end, "Blame Line") - map("n", "ghB", function() gs.blame() end, "Blame Buffer") - map("n", "ghd", gs.diffthis, "Diff This") - map("n", "ghD", function() gs.diffthis("~") end, "Diff This ~") - map({ "o", "x" }, "ih", ":Gitsigns select_hunk", "GitSigns Select Hunk") - end, - }, - }, }