summaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorAgathe Porte <microjoe@microjoe.org>2020-05-06 14:03:07 +0200
committerAgathe Porte <microjoe@microjoe.org>2020-05-06 14:03:07 +0200
commit2d66bc71b936559d10fd9d299a9d022757da9f5f (patch)
tree83c4ea81ec79e8eac1d027fd042a26e315df3639 /plugin
downloadwhitespace.vim-2d66bc71b936559d10fd9d299a9d022757da9f5f.tar.gz
whitespace.vim-2d66bc71b936559d10fd9d299a9d022757da9f5f.zip
initial commit
Diffstat (limited to 'plugin')
-rw-r--r--plugin/whitespace.vim17
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()