Skip to content

[idea] Add vim.diagnostic.open_float() keymap for cursor-position diagnostics #268

Description

@stanfish06

What

Add a normal-mode keymap (e.g. <leader>de) that opens the floating diagnostic window for the current cursor position via vim.diagnostic.open_float().

vim.keymap.set("n", "<leader>de", function()
    vim.diagnostic.open_float({ border = "rounded", source = true })
end, { desc = "Show diagnostics for current line" })

Where

lua/config/options.lua — alongside the existing <leader>d diagnostic list keymap (options.lua:13–19) and the vim.diagnostic.config() block (options.lua:54–66).

Why it matters

The config has three diagnostic display modes — tiny-inline-diagnostic virtual text (always on), <leader>dsetloclist (buffer-wide list), and the quickfix-based :Compile output. What's missing is the cursor-level popup: a floating window that shows the full diagnostic message(s) for the current line without leaving the buffer or opening a list. This is the fastest way to read a long error message or see the full source name when multiple LSPs are active. The float.source = true setting is already configured globally in vim.diagnostic.config() (options.lua:59) but that only affects the hover float style — a keymap is needed to trigger it. <leader>de fits the existing <leader>d diagnostic namespace (mnemonic: diagnostic error / expand).

Recommended action

Add the keymap as shown. The border = "rounded" is already the style set in the global vim.diagnostic.config() float config (options.lua:59), so it will be visually consistent.

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