dotfiles/.config/nvim/lua/plugins/extras/editor/git/diffview.lua
2024-01-15 01:00:49 +01:00

44 lines
2.6 KiB
Lua

return {
{
"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" },
},
},
},
}