diff options
author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2024-05-28 13:24:16 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-28 13:24:16 -0500 |
commit | 1c6d9200521acb2329be55ab8bec3056deade66a (patch) | |
tree | bcb4c4540256ed7643ca8516e5616b9ffcbea151 /runtime/lua/vim/_defaults.lua | |
parent | fc2429962ac8837eba45e4e62cfccc57e5049441 (diff) | |
download | rneovim-1c6d9200521acb2329be55ab8bec3056deade66a.tar.gz rneovim-1c6d9200521acb2329be55ab8bec3056deade66a.tar.bz2 rneovim-1c6d9200521acb2329be55ab8bec3056deade66a.zip |
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.
Diffstat (limited to 'runtime/lua/vim/_defaults.lua')
-rw-r--r-- | runtime/lua/vim/_defaults.lua | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index 5b964b84a0..26d8729029 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -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() |