mirror of
https://github.com/neovim/neovim.git
synced 2025-12-10 00:22:41 +00:00
feat(defaults): use vim.diagnostic.jump() for default mappings (#29066)
This allows the mappings to work with a count and also enables new ]D and [D mappings to go to the last/first diagnostic in the buffer.
This commit is contained in:
@@ -180,12 +180,20 @@ do
|
||||
--- See |[d-default|, |]d-default|, and |CTRL-W_d-default|.
|
||||
do
|
||||
vim.keymap.set('n', ']d', function()
|
||||
vim.diagnostic.goto_next({ float = false })
|
||||
end, { desc = 'Jump to the next diagnostic' })
|
||||
vim.diagnostic.jump({ count = vim.v.count1, float = false })
|
||||
end, { desc = 'Jump to the next diagnostic in the current buffer' })
|
||||
|
||||
vim.keymap.set('n', '[d', function()
|
||||
vim.diagnostic.goto_prev({ float = false })
|
||||
end, { desc = 'Jump to the previous diagnostic' })
|
||||
vim.diagnostic.jump({ count = -vim.v.count1, float = false })
|
||||
end, { desc = 'Jump to the previous diagnostic in the current buffer' })
|
||||
|
||||
vim.keymap.set('n', ']D', function()
|
||||
vim.diagnostic.jump({ count = math.huge, wrap = false, float = false })
|
||||
end, { desc = 'Jump to the last diagnostic in the current buffer' })
|
||||
|
||||
vim.keymap.set('n', '[D', function()
|
||||
vim.diagnostic.jump({ count = -math.huge, wrap = false, float = false })
|
||||
end, { desc = 'Jump to the first diagnostic in the current buffer' })
|
||||
|
||||
vim.keymap.set('n', '<C-W>d', function()
|
||||
vim.diagnostic.open_float()
|
||||
|
||||
Reference in New Issue
Block a user