make sure the cursor doesn't move when removing tailing whitespaces
This commit is contained in:
parent
e142e4c91f
commit
43f78930ca
1 changed files with 5 additions and 1 deletions
|
|
@ -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', {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue