diff options
author | Romain Porte <microjoe@microjoe.org> | 2020-05-06 14:03:07 +0200 |
---|---|---|
committer | Romain Porte <microjoe@microjoe.org> | 2020-05-06 14:03:07 +0200 |
commit | 66299f1637bbe02058b57897ebec6973cd99edd5 (patch) | |
tree | 04602c6be4442413d9c7a400f710c44a458f9c8d /plugin/whitespace.vim | |
download | whitespace.vim-66299f1637bbe02058b57897ebec6973cd99edd5.tar.gz whitespace.vim-66299f1637bbe02058b57897ebec6973cd99edd5.zip |
initial commit
Diffstat (limited to 'plugin/whitespace.vim')
-rw-r--r-- | plugin/whitespace.vim | 17 |
1 files changed, 17 insertions, 0 deletions
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() |