neovim-config/lua/plugins/diffview.lua

25 lines
840 B
Lua
Raw Normal View History

return {
"sindrets/diffview.nvim",
cmd = { "DiffviewOpen", "DiffviewClose", "DiffviewToggleFiles", "DiffviewFocusFiles" },
opts = {
enhanced_diff_hl = true,
keymaps = {
view = {
["gq"] = "<Cmd>DiffviewClose<CR>",
},
file_panel = {
["gq"] = "<Cmd>DiffviewClose<CR>",
},
file_history_panel = {
["gq"] = "<Cmd>DiffviewClose<CR>",
},
},
},
keys = {
{ "v", "<leader>gl", "<cmd>'<,'>DiffviewFileHistory<cr>", desc = "Toggle git log of selected lines" },
{ "<leader>gL", "<cmd>DiffviewFileHistory<cr>", desc = "Toggle git log of current branch" },
{ "<leader>gl", "<cmd>DiffviewFileHistory %<cr>", desc = "Toggle git log of current file history" },
{ "<leader>gd", "<cmd>DiffviewOpen<cr>", desc = "Git diff current file against the index" },
},
}