perf(util): split lazyvim.util in smaller separate modules

This commit is contained in:
Folke Lemaitre 2023-10-10 19:29:24 +02:00
parent b304db9236
commit aa0e4f52e4
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
20 changed files with 442 additions and 283 deletions

View file

@ -1,3 +1,4 @@
---@class lazyvim.util.ui
local M = {}
---@alias Sign {name:string, text:string, texthl:string, priority:number}
@ -119,4 +120,13 @@ function M.statuscolumn()
}, "")
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)
---@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
end
return M