diff --git a/lua/custom/plugins/diffview.lua b/lua/custom/plugins/diffview.lua new file mode 100644 index 00000000..14e7cb8c --- /dev/null +++ b/lua/custom/plugins/diffview.lua @@ -0,0 +1,16 @@ +return { + 'sindrets/diffview.nvim', + cmd = { 'DiffviewOpen', 'DiffviewClose', 'DiffviewToggleFiles', 'DiffviewFocusFiles' }, + opts = {}, + keys = { { 'gd', 'DiffviewOpen', desc = 'DiffView' } }, + config = function() + require('diffview').setup() + vim.keymap.set('n', 'gd', function() + if next(require('diffview.lib').views) == nil then + vim.cmd 'DiffviewOpen' + else + vim.cmd 'DiffviewClose' + end + end) + end, +}