From 982d49be7760ed8ebec7391279182a1360eaf9d3 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Mon, 7 Aug 2023 21:49:42 +0200 Subject: [PATCH] vim/util: center on destination when jumping to diagnostic --- config/nvim/lua/fschauen/util.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/nvim/lua/fschauen/util.lua b/config/nvim/lua/fschauen/util.lua index ac0690e..9b3c6ed 100644 --- a/config/nvim/lua/fschauen/util.lua +++ b/config/nvim/lua/fschauen/util.lua @@ -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.