diff --git a/.config/nvim/lua/plugins/extras/editor/git/diffview.lua b/.config/nvim/lua/plugins/extras/editor/git/diffview.lua index 37b3c97e..3c7c1420 100644 --- a/.config/nvim/lua/plugins/extras/editor/git/diffview.lua +++ b/.config/nvim/lua/plugins/extras/editor/git/diffview.lua @@ -1,4 +1,6 @@ -local prefix = "gC" +local prefix_conflicts = "gc" +local prefix_diffs = "gd" + local function toggle_diffview(cmd) if next(require("diffview.lib").views) == nil then vim.cmd(cmd) @@ -12,9 +14,9 @@ return { "sindrets/diffview.nvim", -- stylua: ignore keys = { - { "gD", function() toggle_diffview("DiffviewFileHistory") end, desc = "Diff Repo" }, - { "gd", function() toggle_diffview("DiffviewOpen") end, desc = "Diff View" }, - { "gF", function() toggle_diffview("DiffviewFileHistory %") end, desc = "Diff Current File" }, + { prefix_diffs .. "D", function() toggle_diffview("DiffviewFileHistory") end, desc = "Diff Repo" }, + { prefix_diffs .. "d", function() toggle_diffview("DiffviewOpen") end, desc = "Diff View" }, + { prefix_diffs .. "f", function() toggle_diffview("DiffviewFileHistory %") end, desc = "Diff Current File History" }, }, opts = function(_, opts) local actions = require("diffview.actions") @@ -33,24 +35,24 @@ return { opts.keymaps = { --stylua: ignore view = { - { "n", prefix .. "o", actions.conflict_choose("ours"), { desc = "Choose the OURS version of a conflict" } }, - { "n", prefix .. "t", actions.conflict_choose("theirs"), { desc = "Choose the THEIRS version of a conflict" } }, - { "n", prefix .. "b", actions.conflict_choose("base"), { desc = "Choose the BASE version of a conflict" } }, - { "n", prefix .. "a", actions.conflict_choose("all"), { desc = "Choose all the versions of a conflict" } }, - { "n", prefix .. "x", actions.conflict_choose("none"), { desc = "Delete the conflict region" } }, - { "n", prefix .. "O", actions.conflict_choose_all("ours"), { desc = "Choose the OURS version of a conflict for the whole file" } }, - { "n", prefix .. "T", actions.conflict_choose_all("theirs"), { desc = "Choose the THEIRS version of a conflict for the whole file" } }, - { "n", prefix .. "B", actions.conflict_choose_all("base"), { desc = "Choose the BASE version of a conflict for the whole file" } }, - { "n", prefix .. "A", actions.conflict_choose_all("all"), { desc = "Choose all the versions of a conflict for the whole file" } }, - { "n", prefix .. "X", actions.conflict_choose_all("none"), { desc = "Delete the conflict region for the whole file" } }, + { "n", prefix_conflicts .. "o", actions.conflict_choose("ours"), { desc = "Ours" } }, + { "n", prefix_conflicts .. "t", actions.conflict_choose("theirs"), { desc = "Theirs" } }, + { "n", prefix_conflicts .. "b", actions.conflict_choose("base"), { desc = "Base" } }, + { "n", prefix_conflicts .. "a", actions.conflict_choose("all"), { desc = "All" } }, + { "n", prefix_conflicts .. "d", actions.conflict_choose("none"), { desc = "Delete" } }, + { "n", prefix_conflicts .. "O", actions.conflict_choose_all("ours"), { desc = "Ours (File)" } }, + { "n", prefix_conflicts .. "T", actions.conflict_choose_all("theirs"), { desc = "Theirs (File)" } }, + { "n", prefix_conflicts .. "B", actions.conflict_choose_all("base"), { desc = "Base (File)" } }, + { "n", prefix_conflicts .. "A", actions.conflict_choose_all("all"), { desc = "All (File)" } }, + { "n", prefix_conflicts .. "D", actions.conflict_choose_all("none"), { desc = "Delete (File)" } }, }, --stylua: ignore file_panel = { - { "n", prefix .. "O", actions.conflict_choose_all("ours"), { desc = "Choose the OURS version of a conflict for the whole file" } }, - { "n", prefix .. "T", actions.conflict_choose_all("theirs"), { desc = "Choose the THEIRS version of a conflict for the whole file" } }, - { "n", prefix .. "B", actions.conflict_choose_all("base"), { desc = "Choose the BASE version of a conflict for the whole file" } }, - { "n", prefix .. "A", actions.conflict_choose_all("all"), { desc = "Choose all the versions of a conflict for the whole file" } }, - { "n", prefix .. "X", actions.conflict_choose_all("none"), { desc = "Delete the conflict region for the whole file" } }, + { "n", prefix_conflicts .. "O", actions.conflict_choose_all("ours"), { desc = "Ours (File)" } }, + { "n", prefix_conflicts .. "T", actions.conflict_choose_all("theirs"), { desc = "Theirs (File)" } }, + { "n", prefix_conflicts .. "B", actions.conflict_choose_all("base"), { desc = "Base (File)" } }, + { "n", prefix_conflicts .. "A", actions.conflict_choose_all("all"), { desc = "All (File)" } }, + { "n", prefix_conflicts .. "X", actions.conflict_choose_all("none"), { desc = "Delete (File)" } }, }, } end, @@ -68,7 +70,8 @@ return { "folke/which-key.nvim", opts = { spec = { - { prefix, group = "conflicts", icon = " " }, + { prefix_conflicts, group = "conflicts", icon = " " }, + { prefix_diffs, group = "diff", icon = " " }, }, }, }, diff --git a/.config/nvim/lua/plugins/extras/editor/git/git-conflict.lua b/.config/nvim/lua/plugins/extras/editor/git/git-conflict.lua index d554c00c..8b6bed1a 100644 --- a/.config/nvim/lua/plugins/extras/editor/git/git-conflict.lua +++ b/.config/nvim/lua/plugins/extras/editor/git/git-conflict.lua @@ -1,4 +1,4 @@ -local prefix = "gC" +local prefix = "gc" vim.api.nvim_create_autocmd("User", { pattern = "GitConflictDetected", @@ -11,27 +11,19 @@ return { { "akinsho/git-conflict.nvim", opts = { - default_mappings = { - ours = prefix .. "o", - theirs = prefix .. "t", - none = prefix .. "n", - both = prefix .. "b", - }, - }, - cmd = { - "GitConflictChooseTheirs", - "GitConflictChooseOurs", - "GitConflictChooseBoth", - "GitConflictListQf", - "GitConflictRefresh", - "GitConflictNextConflict", - "GitConflictPrevConflict", + default_mappings = false, + disable_diagnostics = true, }, + event = "VeryLazy", keys = { { "]g", "GitConflictNextConflict", desc = "Next Conflict" }, { "[g", "GitConflictPrevConflict", desc = "Previous Conflict" }, { prefix .. "l", "GitConflictListQf", desc = "List Conflicts" }, { prefix .. "r", "GitConflictRefresh", desc = "Refresh Conflicts" }, + { prefix .. "b", mode = { "n", "v" }, "GitConflictChooseBoth", desc = "Both" }, + { prefix .. "o", mode = { "n", "v" }, "GitConflictChooseOurs", desc = "Ours" }, + { prefix .. "t", mode = { "n", "v" }, "GitConflictChooseTheirs", desc = "Theirs" }, + { prefix .. "n", mode = { "n", "v" }, "GitConflictChooseNone", desc = "None" }, }, }, { diff --git a/.config/nvim/lua/plugins/extras/util/snacks-extended.lua b/.config/nvim/lua/plugins/extras/util/snacks-extended.lua index 4aac5a95..4b5dbeb3 100644 --- a/.config/nvim/lua/plugins/extras/util/snacks-extended.lua +++ b/.config/nvim/lua/plugins/extras/util/snacks-extended.lua @@ -98,7 +98,6 @@ return { current = false, sort_lastused = true, }) end, desc = "Buffers" }, - { "gB", function() Snacks.picker.git_branches() end, desc = "Git Branches" }, { "go", function() Snacks.gitbrowse() end, desc = "Git Open Line" }, }, }