From 2d66bc71b936559d10fd9d299a9d022757da9f5f Mon Sep 17 00:00:00 2001 From: Agathe Porte Date: Wed, 6 May 2020 14:03:07 +0200 Subject: initial commit --- plugin/whitespace.vim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 plugin/whitespace.vim (limited to 'plugin') diff --git a/plugin/whitespace.vim b/plugin/whitespace.vim new file mode 100644 index 0000000..a084470 --- /dev/null +++ b/plugin/whitespace.vim @@ -0,0 +1,17 @@ +" whitespace.vim - remove whitespaces on save + +if exists('g:loaded_whitespace') || &compatible + finish +else + let g:loaded_whitespace = 1 +endif + +fun! StripTrailingWhitespace() + " Do not strip the whitespaces on these specific filetypes + if &ft =~ 'markdown' + return + endif + %s/\s\+$//e +endfun + +au BufWritePre * call StripTrailingWhitespace() -- cgit v1.2.3