♻️ refactor(nvim): diffview bindings changed as well as fixed git conflict not working correctly

This commit is contained in:
Sergio Laín 2023-11-19 02:55:18 +01:00
parent 1d7cc9c1d0
commit a52a496e5b
No known key found for this signature in database
GPG key ID: 14C9B8080681777B
2 changed files with 53 additions and 15 deletions

View file

@ -1,7 +1,44 @@
return {
"sindrets/diffview.nvim",
keys = {
{ "<leader>gd", "<cmd>DiffviewFileHistory<CR>", desc = "Diff File History" },
{
"sindrets/diffview.nvim",
keys = {
{ "<leader>gd", "<cmd>DiffviewFileHistory<CR>", desc = "Diff File History" },
{ "<leader>gD", "<cmd>DiffviewOpen<CR>", desc = "Diff View Open" },
},
opts = function(_, opts)
local actions = require("diffview.actions")
opts.keymaps = {
--stylua: ignore
view = {
{ "n", "<leader>gCo", actions.conflict_choose("ours"), { desc = "Choose the OURS version of a conflict" } },
{ "n", "<leader>gCt", actions.conflict_choose("theirs"), { desc = "Choose the THEIRS version of a conflict" } },
{ "n", "<leader>gCb", actions.conflict_choose("base"), { desc = "Choose the BASE version of a conflict" } },
{ "n", "<leader>gCa", actions.conflict_choose("all"), { desc = "Choose all the versions of a conflict" } },
{ "n", "<leader>gCx", actions.conflict_choose("none"), { desc = "Delete the conflict region" } },
{ "n", "<leader>gCO", actions.conflict_choose_all("ours"), { desc = "Choose the OURS version of a conflict for the whole file" } },
{ "n", "<leader>gCT", actions.conflict_choose_all("theirs"), { desc = "Choose the THEIRS version of a conflict for the whole file" } },
{ "n", "<leader>gCB", actions.conflict_choose_all("base"), { desc = "Choose the BASE version of a conflict for the whole file" } },
{ "n", "<leader>gCA", actions.conflict_choose_all("all"), { desc = "Choose all the versions of a conflict for the whole file" } },
{ "n", "<leader>gCX", actions.conflict_choose_all("none"), { desc = "Delete the conflict region for the whole file" } },
},
--stylua: ignore
file_panel = {
{ "n", "<leader>gCO", actions.conflict_choose_all("ours"), { desc = "Choose the OURS version of a conflict for the whole file" } },
{ "n", "<leader>gCT", actions.conflict_choose_all("theirs"), { desc = "Choose the THEIRS version of a conflict for the whole file" } },
{ "n", "<leader>gCB", actions.conflict_choose_all("base"), { desc = "Choose the BASE version of a conflict for the whole file" } },
{ "n", "<leader>gCA", actions.conflict_choose_all("all"), { desc = "Choose all the versions of a conflict for the whole file" } },
{ "n", "<leader>gCX", actions.conflict_choose_all("none"), { desc = "Delete the conflict region for the whole file" } },
},
}
end,
},
{
"folke/which-key.nvim",
opts = {
defaults = {
["<leader>gC"] = { name = "+conflicts" },
},
},
},
opts = {},
}

View file

@ -4,21 +4,22 @@ return {
opts = {
default_mappings = false,
},
version = "v1.0.0",
cmd = { "GitConflictChooseTheirs", "GitConflictChooseOurs", "GitConflictChooseBoth", "GitConflictListQf" },
keys = {
{ "<leader>gct", "<cmd>GitConflictChooseTheirs<cr>", desc = "Choose Their Changes" },
{ "<leader>gco", "<cmd>GitConflictChooseOurs<cr>", desc = "Choose Our Changes" },
{ "<leader>gcb", "<cmd>GitConflictChooseBoth<cr>", desc = "Choose Both changes" },
{ "<leader>gcl", "<cmd>GitConflictListQf<cr>", desc = "Git Conflict Quicklist" },
{ "<leader>gCt", "<cmd>GitConflictChooseTheirs<cr>", desc = "Choose Their Changes" },
{ "<leader>gCo", "<cmd>GitConflictChooseOurs<cr>", desc = "Choose Our Changes" },
{ "<leader>gCb", "<cmd>GitConflictChooseBoth<cr>", desc = "Choose Both changes" },
{ "<leader>gCl", "<cmd>GitConflictListQf<cr>", desc = "Git Conflict Quicklist" },
{ "[g", "<cmd>GitConflictPrevConflict<cr>", desc = "Prev Git Conflict" },
{ "]g", "<cmd>GitConflictPrevConflict<cr>", desc = "Next Git Conflict" },
},
{
"folke/which-key.nvim",
opts = {
defaults = {
["<leader>gc"] = { name = "+conflicts" },
},
},
{
"folke/which-key.nvim",
opts = {
defaults = {
["<leader>gC"] = { name = "+conflicts" },
},
},
},