summaryrefslogtreecommitdiffstats
path: root/plugin/whitespace.vim
blob: a0844706673ac21418d102529f38bc9ee4ca6639 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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()