Skip to content

[idea] Add diagnostic jump keymaps ]d / [d to complement existing diagnostic config #131

Description

@stanfish06

What

Wire ]d / [d (next/prev diagnostic) to vim.diagnostic.goto_next() / vim.diagnostic.goto_prev() in options.lua.

Where

lua/config/options.lua — near the existing <leader>d diagnostic loclist keymap at line 12.

Why it matters

The config already invests in diagnostics: virtual text with prefix, float with rounded border and source labels, severity sorting, and <leader>d to populate the loclist. But there is no way to jump between diagnostics without opening the list first. ]d/[d would make diagnostic navigation as fluid as the existing ]g/[g (git hunks) and ]f/[f (functions) motions already in this config. The pattern is established; this fills the obvious gap.

Neovim 0.10+ ships vim.diagnostic.goto_next() and vim.diagnostic.goto_prev() natively — no extra plugins required.

Suggested implementation

In lua/config/options.lua near the existing <leader>d binding:

vim.keymap.set("n", "]d", function()
    vim.diagnostic.goto_next({ count = vim.v.count1 })
end, { desc = "Next diagnostic" })
vim.keymap.set("n", "[d", function()
    vim.diagnostic.goto_prev({ count = vim.v.count1 })
end, { desc = "Prev diagnostic" })

The count option makes 2]d skip to the second next diagnostic, consistent with how vim-sneak and other motion plugins handle counts in this config.

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