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:
1 parent
f23d3cee42
commit
5012d7d839
1 file changed
+2
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user