From 3cb53f9cf13ffec80a0f752e02c07936fa9e7419 Mon Sep 17 00:00:00 2001 From: Brian Henderson Date: Sun, 21 Dec 2025 13:55:56 +0100 Subject: [PATCH] new sarif viewer and add vscode-diff --- lua/custom/plugins/sarif.lua | 9 +++- lua/custom/plugins/vscode-diff.lua | 66 ++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 lua/custom/plugins/vscode-diff.lua diff --git a/lua/custom/plugins/sarif.lua b/lua/custom/plugins/sarif.lua index 004970f0..2cafa8cb 100644 --- a/lua/custom/plugins/sarif.lua +++ b/lua/custom/plugins/sarif.lua @@ -1,3 +1,10 @@ +-- return { +-- 'fguisso/sfer.nvim', +-- } +vim.keymap.set('n', 'fs', 'SarifView') +vim.keymap.set('n', '', 'SarifCodeFlowNext') +vim.keymap.set('n', '', 'SarifCodeFlowPrev') + return { - 'fguisso/sfer.nvim', + 'bhendo/sarif.nvim', } diff --git a/lua/custom/plugins/vscode-diff.lua b/lua/custom/plugins/vscode-diff.lua new file mode 100644 index 00000000..efcd4c56 --- /dev/null +++ b/lua/custom/plugins/vscode-diff.lua @@ -0,0 +1,66 @@ +return { + 'esmuellert/vscode-diff.nvim', + dependencies = { 'MunifTanjim/nui.nvim' }, + cmd = 'CodeDiff', + config = function() + require('vscode-diff').setup { + -- Highlight configuration + highlights = { + -- Line-level: accepts highlight group names or hex colors (e.g., "#2ea043") + line_insert = 'DiffAdd', -- Line-level insertions + line_delete = 'DiffDelete', -- Line-level deletions + + -- Character-level: accepts highlight group names or hex colors + -- If specified, these override char_brightness calculation + char_insert = nil, -- Character-level insertions (nil = auto-derive) + char_delete = nil, -- Character-level deletions (nil = auto-derive) + + -- Brightness multiplier (only used when char_insert/char_delete are nil) + -- nil = auto-detect based on background (1.4 for dark, 0.92 for light) + char_brightness = nil, -- Auto-adjust based on your colorscheme + }, + + -- Diff view behavior + diff = { + disable_inlay_hints = true, -- Disable inlay hints in diff windows for cleaner view + max_computation_time_ms = 5000, -- Maximum time for diff computation (VSCode default) + }, + + -- Explorer panel configuration + explorer = { + position = 'left', -- "left" or "bottom" + width = 40, -- Width when position is "left" (columns) + height = 15, -- Height when position is "bottom" (lines) + indent_markers = true, -- Show indent markers in tree view (│, ├, └) + icons = { + folder_closed = '', -- Nerd Font folder icon (customize as needed) + folder_open = '', -- Nerd Font folder-open icon + }, + view_mode = 'list', -- "list" or "tree" + file_filter = { + ignore = {}, -- Glob patterns to hide (e.g., {"*.lock", "dist/*"}) + }, + }, + + -- Keymaps in diff view + keymaps = { + view = { + quit = 'q', -- Close diff tab + toggle_explorer = 'b', -- Toggle explorer visibility (explorer mode only) + next_hunk = ']c', -- Jump to next change + prev_hunk = '[c', -- Jump to previous change + next_file = ']f', -- Next file in explorer mode + prev_file = '[f', -- Previous file in explorer mode + diff_get = 'do', -- Get change from other buffer (like vimdiff) + diff_put = 'dp', -- Put change to other buffer (like vimdiff) + }, + explorer = { + select = '', -- Open diff for selected file + hover = 'K', -- Show file diff preview + refresh = 'R', -- Refresh git status + toggle_view_mode = 'i', -- Toggle between 'list' and 'tree' views + }, + }, + } + end, +}