From aed0b5a30eaddf5283b4dd0c5065d86b6795a59b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 5 Feb 2021 11:57:28 +0200 Subject: [PATCH] [nvim] fix FixWhitespaceOnSave flooding the search history --- nvim/plugin/files.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nvim/plugin/files.vim b/nvim/plugin/files.vim index f07659f..b9266d5 100644 --- a/nvim/plugin/files.vim +++ b/nvim/plugin/files.vim @@ -144,9 +144,9 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" 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 " }}}