vim.diagnostic.goto_{next,prev} are deprecated #2017
-
Hey guys, probably the wrong place to ask, but I hope someone is just smarter than I am.
In init.lua I have something like: require('lazy').setup({
-- ...
{
'neovim/nvim-lspconfig',
-- config = function() ... end
keys = {
{ '<leader>dk', vim.diagnostic.goto_prev, desc = '[d]iagnostic goto_prev [k]' },
{ '<leader>dj', vim.diagnostic.goto_next, desc = '[d]iagnostic goto_next [j]' },
}
},
-- ...
}) I took those from the documentation of https://github.com/neovim/nvim-lspconfig repository. I cannot find any such thing there anymore. The question is... How do I update these keybindings to use
-- e.g.
{ '<leader>dk', vim.diagnostic.jump({count=-1, float=true}), desc = '[d]iagnostic goto_prev [k]' }, I looked in LazyVim as well where Any hint how to configure that correcty? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
By using parentheses { '<leader>dk', function() vim.diagnostic.jump({count=-1, float=true}) end, desc = '[d]iagnostic goto_prev [k]' },
{ '<leader>dj', function() vim.diagnostic.jump({count=1, float=true}) end, desc = '[d]iagnostic goto_next [j]' }, |
Beta Was this translation helpful? Give feedback.
By using parentheses
({count=-1, float=true})
you're callingvim.diagnostic.jump
and passing the return value instead of passing the function itself.Wrapping the function call inside a lambda should fix your problem: