[nvim] fix FixWhitespaceOnSave flooding the search history

This commit is contained in:
Dmytro Meleshko 2021-02-05 11:57:28 +02:00
parent 6dc39b0e04
commit aed0b5a30e
1 changed files with 2 additions and 2 deletions

View File

@ -144,9 +144,9 @@ nnoremap <silent><expr> <CR> empty(&buftype) ? ":write<bar>wall\<CR>" : "\<CR>"
function s:FixWhitespaceOnSave()
let l:pos = getpos('.')
" remove trailing whitespace
%s/\s\+$//e
keeppatterns %s/\s\+$//e
" remove trailing newlines
%s/\($\n\s*\)\+\%$//e
keeppatterns %s/\($\n\s*\)\+\%$//e
call setpos('.', l:pos)
endfunction
" }}}