util.lua 542 B

12345678910111213141516171819202122
  1. local M = {}
  2. local function highlight(group, properties)
  3. local bg = properties.bg == nil and "" or "guibg=" .. properties.bg
  4. local fg = properties.fg == nil and "" or "guifg=" .. properties.fg
  5. local style = properties.style == nil and "" or "gui=" .. properties.style
  6. local cmd = table.concat({
  7. "highlight", group, bg, fg, style
  8. }, " ")
  9. vim.api.nvim_command(cmd)
  10. end
  11. function M.initialise(skeleton)
  12. for group, properties in pairs(skeleton) do
  13. highlight(group, properties)
  14. end
  15. end
  16. return M