make sure the cursor doesn't move when removing tailing whitespaces
This commit is contained in:
@ -31,7 +31,11 @@ auto('BufRead', {
|
|||||||
auto('BufWritePre', {
|
auto('BufWritePre', {
|
||||||
group = fsmod,
|
group = fsmod,
|
||||||
desc = 'remove trailing spaces on file save',
|
desc = 'remove trailing spaces on file save',
|
||||||
command = [[%s/\s\+$//e]]
|
callback = function()
|
||||||
|
local pos = vim.api.nvim_win_get_cursor(0)
|
||||||
|
vim.cmd([[%s/\s\+$//e]])
|
||||||
|
vim.api.nvim_win_set_cursor(0, pos)
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
auto('BufWritePre', {
|
auto('BufWritePre', {
|
||||||
|
Reference in New Issue
Block a user