From 1c0623a9dfc717994085f9d9d68ab072f4b5a7a6 Mon Sep 17 00:00:00 2001 From: jkunlin Date: Wed, 28 Aug 2024 23:44:57 +0800 Subject: [PATCH] fix(highlights): give user config higher priority (#306) * fix(highlights): give user config higher priority * Update lua/avante/highlights.lua --------- Co-authored-by: Aaron Pham --- lua/avante/highlights.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/avante/highlights.lua b/lua/avante/highlights.lua index 71e0b93..6779daf 100644 --- a/lua/avante/highlights.lua +++ b/lua/avante/highlights.lua @@ -65,13 +65,13 @@ M.conflict_highlights = function(opts) opts = opts or Config.diff.highlights local get_default_colors = function(key, hl) - --- We will first check for the hl name. If plugins set this then we won't use the default opts[var_accesor] + --- We will first check for user custom highlight. Then fallback to default name highlight. local cl - cl = api.nvim_get_hl(0, { name = hl.name }) + cl = api.nvim_get_hl(0, { name = opts[key:lower()] }) if cl ~= nil then return cl.bg or hl.bg end - cl = api.nvim_get_hl(0, { name = opts[key:lower()] }) + cl = api.nvim_get_hl(0, { name = hl.name }) return cl.bg or hl.bg end