summaryrefslogtreecommitdiffstats
path: root/plugin/whitespace.vim
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/whitespace.vim')
-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()