Rich universal hover for Java, Go, C, and C++. Brings rust-analyzer-level hover help to jdtls, gopls, and clangd — type hierarchy, docs, implementations, and a bundled keyword reference as a fallback when LSP returns nothing.
- hover.nvim
- One or more of:
jdtls,gopls,clangdattached to a buffer
{
"Jlesster/Linus.nvim",
dependencies = { "lewis6991/hover.nvim" },
ft = { "java", "go", "c", "cpp" },
config = function()
require("linus").setup()
end,
}All options with defaults:
require("linus").setup({
priority = 1010, -- hover.nvim provider priority (> LSP default 1000)
border = "single",
max_width = 80,
max_height = 30,
pinnable = true, -- enables <leader>K to pin/unpin the float
keyword_overrides_path = nil, -- path to a Lua file returning override table
sections = {
signature = true,
docs = true,
hierarchy = true,
implementations = true,
fallback = true, -- keyword reference when LSP returns nothing
},
})Point keyword_overrides_path at a Lua file that returns a table:
-- ~/.config/nvim/linus-overrides.lua
return {
java = {
MyAnnotation = "**`@MyAnnotation`** — does something specific to this project.",
},
go = {
myPkg = "**`myPkg`** — internal package for X.",
},
}| Key | Action |
|---|---|
K |
Hover (via hover.nvim) |
gK |
Cycle to previous provider |
<leader>K |
Pin / unpin the last hover float |
Inside a pinned float:
| Key | Action |
|---|---|
q / <Esc> |
Close |
y |
Copy contents to system clipboard |
| Feature | Java | Go | C | C++ |
|---|---|---|---|---|
| Signature | ✓ jdtls extended | ✓ gopls | ✓ clangd | ✓ clangd |
| Javadoc / godoc | ✓ | ✓ | ✓ (doxygen) | ✓ (doxygen) |
| Type hierarchy | ✓ supertypes + subtypes | — | ✓ supertypes | ✓ supertypes |
| Implementations | ✓ | ✓ | — | — |
| Macro info | — | — | ✓ | ✓ |
| Keyword fallback | ✓ | ✓ | ✓ | ✓ (+ C) |