Fixed cursor restore in TrimOnSave autocmd
This commit is contained in:
@@ -26,7 +26,7 @@ vim.api.nvim_create_autocmd('BufWritePre', {
|
|||||||
vim.cmd([[%s/\s\+$//e]]) -- Remove trailing whitespace on every line
|
vim.cmd([[%s/\s\+$//e]]) -- Remove trailing whitespace on every line
|
||||||
vim.cmd([[%s/\n\+\%$//e]]) -- Remove all trailing blank lines
|
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.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,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user