diff options
author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2024-05-28 14:54:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-28 14:54:50 -0500 |
commit | efa45832ea02e777ce3f5556ef3cd959c164ec24 (patch) | |
tree | 8f389204e0fcc05b150af4beb69143445fbe7eeb /runtime/lua/vim/_defaults.lua | |
parent | f09f5c45facc597bb3f70b7821412641bf31a592 (diff) | |
download | rneovim-efa45832ea02e777ce3f5556ef3cd959c164ec24.tar.gz rneovim-efa45832ea02e777ce3f5556ef3cd959c164ec24.tar.bz2 rneovim-efa45832ea02e777ce3f5556ef3cd959c164ec24.zip |
feat: add "jump" options to vim.diagnostic.config() (#29067)
Problem: There is no easy way to configure the behavior of the default
diagnostic "jump" mappings. For example, some users way want to show the
floating window, and some may not (likewise, some way want to only move
between warnings/errors, or disable the "wrap" parameter).
Solution: Add a "jump" table to vim.diagnostic.config() that sets
default values for vim.diagnostic.jump().
Alternatives: Users can override the default mappings to use the exact
options to vim.diagnostic.jump() that they want, but this has a couple
issues:
- While the default mappings are not complicated, they are also not
trivial, so overriding them requires users to understand
implementation details (specifically things like setting "count"
properly).
- If plugins want to change the default mappings, or configure the
behavior in any way (e.g. floating window display), it becomes even
harder for users to tweak specific behavior.
vim.diagnostic.config() already works quite well as the "entry point"
for tuning knobs with diagnostic UI elements, so this fits in nicely and
composes well with existing mental models and idioms.
Diffstat (limited to 'runtime/lua/vim/_defaults.lua')
-rw-r--r-- | runtime/lua/vim/_defaults.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index 26d8729029..79fe5a8513 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -180,19 +180,19 @@ do --- See |[d-default|, |]d-default|, and |CTRL-W_d-default|. do vim.keymap.set('n', ']d', function() - vim.diagnostic.jump({ count = vim.v.count1, float = false }) + vim.diagnostic.jump({ count = vim.v.count1 }) end, { desc = 'Jump to the next diagnostic in the current buffer' }) vim.keymap.set('n', '[d', function() - vim.diagnostic.jump({ count = -vim.v.count1, float = false }) + vim.diagnostic.jump({ count = -vim.v.count1 }) 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 }) + vim.diagnostic.jump({ count = math.huge, wrap = 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 }) + vim.diagnostic.jump({ count = -math.huge, wrap = false }) end, { desc = 'Jump to the first diagnostic in the current buffer' }) vim.keymap.set('n', '<C-W>d', function() |