fix(util.ui.fg): Add link=false to show effective definition (#2542)

Fixes #2540 by showing the effective definition instead of the linked
group name.
This commit is contained in:
Iordanis Petkakis 2024-03-07 12:57:03 +02:00 committed by GitHub
parent f23d3cee42
commit 5012d7d839
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -142,7 +142,8 @@ end
function M.fg(name)
---@type {foreground?:number}?
---@diagnostic disable-next-line: deprecated
local hl = vim.api.nvim_get_hl and vim.api.nvim_get_hl(0, { name = name }) or vim.api.nvim_get_hl_by_name(name, true)
local hl = vim.api.nvim_get_hl and vim.api.nvim_get_hl(0, { name = name, link = false })
or vim.api.nvim_get_hl_by_name(name, true)
---@diagnostic disable-next-line: undefined-field
local fg = hl and (hl.fg or hl.foreground)
return fg and { fg = string.format("#%06x", fg) } or nil