Skip to content

Commit

Permalink
fix: check for FloatBorder before setting winhighlight
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Sep 5, 2022
1 parent 25e0e7f commit af6b91d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -327,7 +327,7 @@ The table below shows all the highlight groups defined for **WhichKey** with the
| *WhichKeySeparator* | DiffAdd | the separator between the key and its label |
| *WhichKeyDesc* | Identifier | the label of the key |
| *WhichKeyFloat* | NormalFloat | Normal in the popup window |
| *WhichKeyBorder* | NormalBorder| Normal in the popup window |
| *WhichKeyBorder* | FloatBorder | Normal in the popup window |
| *WhichKeyValue* | Comment | used by plugins that provide values |

<!-- markdownlint-disable-file MD033 -->
Expand Down
6 changes: 5 additions & 1 deletion lua/which-key/view.lua
Expand Up @@ -55,7 +55,11 @@ function M.show()
vim.api.nvim_buf_set_option(M.buf, "filetype", "WhichKey")
vim.api.nvim_buf_set_option(M.buf, "buftype", "nofile")
-- vim.api.nvim_win_hide(M.win)
vim.api.nvim_win_set_option(M.win, "winhighlight", "NormalFloat:WhichKeyFloat,NormalBorder:WhichKeyBorder")
local winhl = "NormalFloat:WhichKeyFloat"
if vim.fn.hlexists("FloatBorder") == 1 then
winhl = winhl .. ",FloatBorder:WhichKeyBorder"
end
vim.api.nvim_win_set_option(M.win, "winhighlight", winhl)
vim.api.nvim_win_set_option(M.win, "foldmethod", "manual")
vim.api.nvim_win_set_option(M.win, "winblend", config.options.window.winblend)

Expand Down

0 comments on commit af6b91d

Please sign in to comment.