From 5403b04732d38de69d55195e3e1139b26f20b518 Mon Sep 17 00:00:00 2001 From: Francis Belanger Date: Tue, 10 Mar 2026 08:05:36 -0400 Subject: [PATCH] feat(explorer): add CodeDiffExplorerTreeGroup highlight for group headers Add a dedicated highlight group CodeDiffExplorerTreeGroup (linked to Exception) and update explorer nodes to use it for group headers instead of the generic Directory highlight to improve visual grouping. --- lua/codediff/ui/explorer/nodes.lua | 4 ++-- lua/codediff/ui/highlights.lua | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/codediff/ui/explorer/nodes.lua b/lua/codediff/ui/explorer/nodes.lua index f4abec5a..dca08877 100644 --- a/lua/codediff/ui/explorer/nodes.lua +++ b/lua/codediff/ui/explorer/nodes.lua @@ -281,8 +281,8 @@ function M.prepare_node(node, max_width, selected_path, selected_group) if data.type == "group" then -- Group header - line:append(" ", "Directory") - line:append(node.text, "Directory") + line:append(" ", "CodeDiffExplorerTreeGroup") + line:append(node.text, "CodeDiffExplorerTreeGroup") elseif data.type == "directory" then -- Directory node (tree view mode) - with indent markers local indent = build_indent_markers(data.indent_state) diff --git a/lua/codediff/ui/highlights.lua b/lua/codediff/ui/highlights.lua index 02a74bda..a2a2c890 100644 --- a/lua/codediff/ui/highlights.lua +++ b/lua/codediff/ui/highlights.lua @@ -169,6 +169,11 @@ function M.setup() default = true, }) + vim.api.nvim_set_hl(0, "CodeDiffExplorerTreeGroup", { + link = "Exception", + default = true, + }) + -- Explorer git status highlights (customizable, like diffview.nvim) vim.api.nvim_set_hl(0, "CodeDiffStatusAdded", { link = "DiagnosticOk", default = true }) vim.api.nvim_set_hl(0, "CodeDiffStatusModified", { link = "DiagnosticWarn", default = true })