commit 573e4515817d1e27388cb489b92123fb7327b6c7 parent 003067b2bff7d59097c1903b84e38ac1a01bdba0 Author: Alex Balgavy <a.balgavy@gmail.com> Date: Fri, 14 Jun 2019 21:54:27 +0200 Make strip trailing whitespace a plugin Former-commit-id: fbb50dd65656e16ecb0b4a34719cd830dd1a99fc Diffstat:
M | vim/map.vimrc | | | 2 | +- |
A | vim/plugin/strip_trailing_whitespace.vim | | | 16 | ++++++++++++++++ |
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/vim/map.vimrc b/vim/map.vimrc @@ -122,7 +122,7 @@ if mapcheck("<leader>F") == "" endif " Strip trailing whitespace -nnoremap <leader>$ m`:%s/ \+$//e<CR>`` +nmap <leader>$ <Plug>StripTrailingWhitespace nnoremap H :bprevious<CR> nnoremap L :bnext<CR> diff --git a/vim/plugin/strip_trailing_whitespace.vim b/vim/plugin/strip_trailing_whitespace.vim @@ -0,0 +1,16 @@ +" function s:StripTrailingWhitespace() +" if !&binary && &filetype != 'diff' +" normal m` +" %s/\s\+$//e +" normal `` +" endif +" endfunction +function s:StripTrailingWhitespace() + if &filetype != 'diff' + normal m` + %s/\s\+$//e + normal `` + endif +endfunction +nnoremap <Plug>StripTrailingWhitespace + \ :call <SID>StripTrailingWhitespace()<CR>