vim/util: center on destination when jumping to diagnostic

This commit is contained in:
Fernando Schauenburg 2023-08-07 21:49:42 +02:00
parent 3d43af1e8d
commit 982d49be77

View file

@ -88,12 +88,14 @@ local diag_opts = {
---@param opts table: options passed along to `vim.diagnostic.goto_next`.
M.goto_next_diagnostic = function(opts)
vim.diagnostic.goto_next(vim.tbl_extend('keep', opts or {}, diag_opts))
vim.cmd 'normal zz'
end
--- Move to the previous diagnostic.
---@param opts table: options passed along to `vim.diagnostic.goto_prev`.
M.goto_prev_diagnostic = function(opts)
vim.diagnostic.goto_prev(vim.tbl_extend('keep', opts or {}, diag_opts))
vim.cmd 'normal zz'
end
--- Whether the current window is the last in a given direction.