Add diffview

This commit is contained in:
Adam Beck 2025-07-08 09:38:45 -04:00
parent 99c99aafca
commit 5c659f5a9f
1 changed files with 56 additions and 0 deletions

View File

@ -11,6 +11,62 @@ vim.keymap.set('n', '<leader>cpe', ':Copilot enable<cr>', { silent = true, norem
vim.g.copilot_enabled = false
return {
{
'sindrets/diffview.nvim',
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
require('diffview').setup {
diff_binaries = false, -- Show diffs for binaries
enhanced_diff_hl = false, -- See ':h diffview-config-enhanced_diff_hl'
git_cmd = { 'git' }, -- The git executable followed by default args.
use_icons = true, -- Requires nvim-web-devicons
show_help_hints = true, -- Show hints for how to open the help panel
watch_index = true, -- Update views and index on git index changes.
icons = { -- Only applies when use_icons is true.
folder_closed = '',
folder_open = '',
},
signs = {
fold_closed = '',
fold_open = '',
done = '',
},
view = {
-- Configure the layout and behavior of different types of views.
-- Available layouts:
-- 'diff1_plain'
-- |'diff2_horizontal'
-- |'diff2_vertical'
-- |'diff3_horizontal'
-- |'diff3_vertical'
-- |'diff3_mixed'
-- |'diff4_mixed'
-- For more info, see ':h diffview-config-view.x.layout'.
default = {
-- Config for changed files, and staged files in diff views.
layout = 'diff2_horizontal',
winbar_info = false, -- See ':h diffview-config-view.x.winbar_info'
},
merge_tool = {
-- Config for conflicted files in diff views during a merge or rebase.
layout = 'diff3_horizontal',
disable_diagnostics = true, -- Temporarily disable diagnostics for conflict buffers while in the view.
winbar_info = true, -- See ':h diffview-config-view.x.winbar_info'
},
},
}
-- Diffview keymaps
vim.keymap.set('n', '<leader>gd', ':DiffviewOpen<CR>', { desc = 'Open Diffview' })
vim.keymap.set('n', '<leader>gc', ':DiffviewClose<CR>', { desc = 'Close Diffview' })
vim.keymap.set('n', '<leader>gm', ':DiffviewOpen HEAD~1<CR>', { desc = 'Compare with previous commit' })
vim.keymap.set('n', '<leader>gh', ':DiffviewFileHistory<CR>', { desc = 'File history' })
vim.keymap.set('n', '<leader>gH', ':DiffviewFileHistory %<CR>', { desc = 'Current file history' })
-- For merge conflicts specifically
vim.keymap.set('n', '<leader>gco', ':DiffviewOpen<CR>', { desc = 'Open merge conflict view' })
end,
},
{
'olrtg/nvim-emmet',
config = function()