kosayoda / nvim-lightbulb

VSCode 💡 for neovim's built-in LSP.
MIT License
783 stars 27 forks source link

Easier way to set color of signcolumn lightbulb #40

Closed 4e554c4c closed 1 year ago

4e554c4c commented 2 years ago

I didn't like the lightbulb emoji in my current font, so I elected to use an icon and color it yellow. That looks something like this:

vim.cmd[[highlight LightbulbSignYellow guifg=LightYellow ctermfg=LightYellow]]
vim.fn.sign_define('LightBulbSign', { text = "<icon>", texthl = "LightbulbSignYellow", linehl="", numhl="" })

Since I had to set the color using a highlightgroup, i had to first create a highlight group for the sign. Is there any way that this could be made easier? For example nvim-lightbulb could choose a highlight group for texthl, linehl and numhl and users could configure them separately

AbheetChaudhary commented 1 year ago

If you use virtual_text or float mode to show the lightbulb then the highlight group can be edited by:

vim.api.nvim_command('highlight LightBulbVirtualText ctermfg= ctermbg= guifg= guibg=')

or

vim.api.nvim_command('highlight LightBulbFloatWin ctermfg= ctermbg= guifg= guibg=')

...add accordingly to the rest of your config.

kosayoda commented 1 year ago

Hello, with the latest release this can be done in one command:

vim.api.nvim_set_hl(0, "LightBulbSign", {})

where {} is the new highlight.