From 8551dd01d3331af874b913ac9c359256c147faa4 Mon Sep 17 00:00:00 2001 From: hedy Date: Wed, 22 Nov 2023 18:10:36 +0800 Subject: [PATCH] fix(highlights): Only inherit fg for FoldMarker and Guides highlights --- lua/outline/ui.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lua/outline/ui.lua b/lua/outline/ui.lua index 1676b2d..1dcafec 100644 --- a/lua/outline/ui.lua +++ b/lua/outline/ui.lua @@ -51,17 +51,21 @@ function M.setup_highlights() ) end - -- Only inherit fg and bg for OutlineGuides because we do not want the other - -- stylings messing up the alignment. - if vim.fn.hlexists('OutlineGuides') == 0 then - vim.api.nvim_set_hl(0, 'OutlineGuides', get_hl_by_name('Comment')) + -- Only inherit fg for these highlights because we do not want the other + -- stylings messing up the alignment, nor the background so that cursorline + -- can look normal when on top of it. This can be customized by setting these + -- highlights before outline.setup() is called, or using winhl. + for name, link in pairs({ Guides = 'Comment', FoldMarker = 'Normal' }) do + if vim.fn.hlexists('Outline'..name) == 0 then + local h = get_hl_by_name(link) + vim.api.nvim_set_hl(0, 'Outline'..name, { fg = h.fg, ctermfg = h.fg }) + end end for name, link in pairs({ Details = 'Comment', Lineno = 'LineNr', JumpHighlight = 'Visual', - FoldMarker = 'Normal', }) do if vim.fn.hlexists('Outline' .. name) == 0 then vim.api.nvim_set_hl(0, 'Outline' .. name, { link = link })