Skip to content

[idea] Add keymap for vim.diagnostic.open_float() — read full multi-line diagnostic at cursor #97

Description

@stanfish06

What

Add a normal-mode keymap that calls vim.diagnostic.open_float() to pop up the full diagnostic message for the symbol under the cursor.

Where

lua/config/options.lua — alongside the existing <leader>d diagnostic list keymap (line 12).

Why it matters

The config already enables virtual-text diagnostics with prefix = "●" and a <leader>d quickfix list, but virtual text truncates long messages (type errors, clippy suggestions, pyright explanations). open_float() shows the complete message in a readable floating window, which is the standard complement to virtual text in Neovim.

This is distinct from LSP hover (K / vim.lsp.buf.hover) — hover shows documentation; the diagnostic float shows the error/warning text from the active linter/LSP for the current line.

Suggested implementation

In lua/config/options.lua or in the LspAttach callback in lua/config/plugin_config.lua:

vim.keymap.set("n", "<leader>dh", vim.diagnostic.open_float, { desc = "[D]iagnostic [H]over float" })

The float already picks up the rounded border from the existing vim.diagnostic.config({ float = { border = "rounded" } }), so no extra styling is needed.

https://claude.ai/code/session_01UKkC4bUSCfspiXbmc8AFEB

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions