Skip to content

nvim_set_hl color remove problem #24405

Closed Answered by seandewar
EdiDD asked this question in Q&A
Discussion options

You must be logged in to vote

You can create a utility function, especially if you want to do this a lot:

function modify_hl(ns, name, changes)
  local def = vim.api.nvim_get_hl(ns, { name = name, link = false })
  vim.api.nvim_set_hl(ns, name, vim.tbl_deep_extend("force", def, changes))
end

Then in your case: modify_hl(0, "TSFunction", { bold = true, italic = true })

Note: modify_hl assumes that if the group is linked, that you want to resolve the "effective" definition and modify that.
If you instead want to set fallback attributes in case the group is unlinked later (unlikely), remove link = false.

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by EdiDD
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants