How do I open a floating window showing diagnostic details at the cursor using a built-in Neovim key?
Answer
<C-w>d
Explanation
Neovim 0.10+ includes <C-w>d as a built-in normal-mode key that opens a floating window displaying the full diagnostic message at the cursor position. No configuration or plugins are required — it works out of the box wherever LSP or diagnostic providers are active.
How it works
<C-w>dis bound by default tovim.diagnostic.open_float()in Neovim 0.10+- The float shows the full diagnostic text, severity, and source (e.g. which LSP reported the error)
- Press
<C-w>dagain (or any key) to close the float - Unlike virtual text which truncates long messages, the float always shows the complete diagnostic
Example
With the cursor on a line that has an LSP error:
Press <C-w>d
A floating window appears:
┌─────────────────────────────────────────────┐
│ E: cannot find value `foo` in this scope │
│ rust-analyzer │
└─────────────────────────────────────────────┘
Tips
- If multiple diagnostics are on the same line, the float shows them all
- To navigate between diagnostics, use
]d/[d(Neovim 0.10+ defaults) - To customize the float appearance, configure
vim.diagnostic.config({float = {...}}) - This works for any diagnostic source: LSP,
null-ls, linters, etc.