I have such binding that opens the hover window

vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)

As you can see the background color of the let name2: {unknown} is white (#ffffff). I would like to make it transparent

enter image description here

How can I change the background color of the text?

P.S. I use Lua as a configuration language


1 Answer 1


That should be controlled by the NormalFloat highlight group. I have the following setting in Lua to make it "transparent" (same color as the buffer background):

local set_hl_for_floating_window = function()
  vim.api.nvim_set_hl(0, 'NormalFloat', {
    link = 'Normal',
  vim.api.nvim_set_hl(0, 'FloatBorder', {
    bg = 'none',


vim.api.nvim_create_autocmd('ColorScheme', {
  pattern = '*',
  desc = 'Avoid overwritten by loading color schemes later',
  callback = set_hl_for_floating_window,

  • Thanks, I will try it as soon as possible and get back to you with feedback Dec 9, 2022 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.