folke / which-key.nvim

💥 Create key bindings that stick. WhichKey helps you remember your Neovim keymaps, by showing available keybindings in a popup as you type.
Apache License 2.0
5.12k stars 163 forks source link

bug: WhichKeyFloat highlight group is ignored #661

Closed ALVAROPING1 closed 1 month ago

ALVAROPING1 commented 1 month ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.10.0

Operating system/version

Ubuntu 22.04

Describe the bug

The highlight group WhichKeyFloat is ignored in the popup window, instead using NormalFloat directly

Steps To Reproduce

  1. Set WhichKeyFloat to a bg color different from NormalFloat
  2. Open which-key
  3. See that the color used is that of NormalFloat instead of WhichKeyFloat

Expected Behavior

When WhichKeyFloat highlight group is set, it is used for the background color of the window

Health

No response

Log

Debug Started for v3.2.0
on_key: <Space>
State(start): { "Mode(n)", "Node(<Space>)", { keys = "<Space>", update = true, waited = 0 } }
  getchar
  on_key: n
  got: n
  reattach: { "<Space>n", "n" }
  detach: <Space>
  feedkeys: { "Mode(n)", "<Space>n" }
on_key: <Space>n
attach: { "<Space>", "n" }
on_key: <Space>
State(start): { "Mode(n)", "Node(<Space>)", { keys = "<Space>", update = true, waited = 0 } }
  getchar
  on_key: <Esc>
  got: <Esc>
on_key: <Space>
State(start): { "Mode(n)", "Node(<Space>)", { keys = "<Space>", update = true, waited = 0 } }
  getchar
  on_key: q
  got: q
  reattach: { "<Space>q", "n" }
  detach: <Space>
  feedkeys: { "Mode(n)", "<Space>q" }
on_key: <Space>q
attach: { "<Space>", "n" }

Repro

vim.g.mapleader = " "
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

-- Make bg color change easy to see
vim.api.nvim_set_hl(0, "WhichKeyFloat", { bg = "#ff00ff" })

require("lazy.minit").repro({
    spec = {
        { "folke/which-key.nvim", opts = {} },
        -- add any other plugins here
    },
})

local wk = require("which-key")
wk.add({
    { "<leader>t", "<cmd>lua print(1)<cr>", desc = "test mapping" }, -- test mapping to display the window
})
folke commented 1 month ago

Fixed and also changed the group name while I was at it to WhichKeyNormal

border and title will also work correctly now