From bc923014bba3e5674b7bbbc4bf5f819af92527cc Mon Sep 17 00:00:00 2001 From: Nicola Belluti Date: Sat, 8 Aug 2026 22:29:12 +0200 Subject: [PATCH] Fixed cursor restore in TrimOnSave autocmd --- home/private_dot_config/nvim/lua/settings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/private_dot_config/nvim/lua/settings.lua b/home/private_dot_config/nvim/lua/settings.lua index 0ff1dac..7bd1225 100644 --- a/home/private_dot_config/nvim/lua/settings.lua +++ b/home/private_dot_config/nvim/lua/settings.lua @@ -26,7 +26,7 @@ vim.api.nvim_create_autocmd('BufWritePre', { vim.cmd([[%s/\s\+$//e]]) -- Remove trailing whitespace on every line vim.cmd([[%s/\n\+\%$//e]]) -- Remove all trailing blank lines vim.fn.append(vim.fn.line('$'), '') -- Always append exactly one blank line at the end - vim.fn.setpos('.', save_cursor) -- Restore the window to where it was before the edits + vim.fn.winrestview(save_view) -- Restore the window to where it was before the edits end, })