hover.nvim
hover.nvim copied to clipboard
Is hover open?
This is similar to #1 . <c-n> and <C-p> are being mapped unconditionally in the suggested config. I would like to map them to switch hover providers only if hover is open, otherwise fallback to <C-n> / <C-p> (or nav through other popup menu which may be open etc.. How do I tell if a hover popup is currently open or not?
Hey! I was looking into something similar and found a solution:
local bufnr = vim.api.nvim_get_current_buf()
local hover_win = vim.b[bufnr].hover_preview
if hover_win and vim.api.nvim_win_is_valid(hover_win) then
-- window is open
else
-- window is closed
end
Pretty much the same code is used in the enter function (source).
I hope this helps 🙂