fix(buffer): link highlight groups to colorscheme via default = true

Problem: highlight groups used hardcoded hex colours and a bespoke
hlexists guard, ignoring the user's colorscheme and preventing
overrides from working naturally.

Solution: replace the guard wrapper with direct nvim_set_hl calls
using default = true and link, so each group falls back to a
semantically appropriate built-in group (Title, DiagnosticHint,
DiagnosticError, Comment, DiagnosticWarn) unless the user has
already defined them.
This commit is contained in:
Barrett Ruth 2026-02-24 19:48:13 -05:00 committed by Barrett Ruth
parent f0b58df317
commit 6b14a6bf90

View file

@ -145,16 +145,11 @@ local function apply_extmarks(bufnr, line_meta)
end
local function setup_highlights()
local function hl(name, opts)
if vim.fn.hlexists(name) == 0 or vim.tbl_isempty(vim.api.nvim_get_hl(0, { name = name })) then
vim.api.nvim_set_hl(0, name, opts)
end
end
hl('PendingHeader', { bold = true })
hl('PendingDue', { fg = '#888888', italic = true })
hl('PendingOverdue', { fg = '#e06c75', italic = true })
hl('PendingDone', { strikethrough = true, fg = '#666666' })
hl('PendingPriority', { fg = '#e06c75', bold = true })
vim.api.nvim_set_hl(0, 'PendingHeader', { link = 'Title', default = true })
vim.api.nvim_set_hl(0, 'PendingDue', { link = 'DiagnosticHint', default = true })
vim.api.nvim_set_hl(0, 'PendingOverdue', { link = 'DiagnosticError', default = true })
vim.api.nvim_set_hl(0, 'PendingDone', { link = 'Comment', default = true })
vim.api.nvim_set_hl(0, 'PendingPriority', { link = 'DiagnosticWarn', default = true })
end
---@param bufnr? integer