better hover

This commit is contained in:
2026-06-11 14:12:20 +02:00
parent 41144f2c76
commit bd6b4722e5
2 changed files with 186 additions and 9 deletions
+4 -9
View File
@@ -10,15 +10,10 @@ for _, mode in ipairs({ "n", "v" }) do
map(mode, "k", "gk", silent)
end
-- Hover: diagnostics on current line if any, else LSP hover
map("n", "K", function()
local line = vim.api.nvim_win_get_cursor(0)[1] - 1
if #vim.diagnostic.get(0, { lnum = line }) > 0 then
vim.diagnostic.open_float()
else
vim.lsp.buf.hover()
end
end, { desc = "Hover (diagnostic or LSP)" })
-- Hover: cycle diagnostics on the current line, then LSP hover. <CR> enters.
local hover = require("hover")
map("n", "K", hover.hover, { desc = "Hover (cycle diagnostics / LSP)" })
map("n", "<CR>", hover.enter, { desc = "Enter hover window", silent = true })
-- LSP
map("n", "<leader>gf",