From c6ef9c5a3a2ece0f8635460291eb4a4c06ed3dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E8=91=89?= Date: Mon, 13 Mar 2023 10:38:28 +0800 Subject: Fix(color): fix the custom attribute does not take effect. #205 (#207) Co-authored-by: Ellison --- lua/gruvbox/groups.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lua') diff --git a/lua/gruvbox/groups.lua b/lua/gruvbox/groups.lua index 318d3ed..a65cc25 100644 --- a/lua/gruvbox/groups.lua +++ b/lua/gruvbox/groups.lua @@ -785,10 +785,16 @@ M.setup = function() } for group, hl in pairs(config.overrides) do + -- When `link` is set together with other attrs, only `link` will take effect. + -- e.g. `{ link = "GruvboxRed", fg = colors.blue }` The final color is red. + -- Dereference the `link` and let user overrides it's attr. + local link = nil if groups[group] and not vim.tbl_isempty(hl) then - groups[group].link = nil + link = groups[group]["link"] + groups[group]["link"] = nil end - groups[group] = vim.tbl_extend("force", groups[group] or {}, hl) + + groups[group] = vim.tbl_extend("force", groups[group] or {}, groups[link] or {}, hl) end return groups -- cgit v1.2.3