[nvim] fix FixWhitespaceOnSave flooding the search history

This commit is contained in:
Dmytro Meleshko 2021-02-05 11:57:28 +02:00 committed by pull[bot]
parent 618995cc7f
commit da7c44af35
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
" }}}