Vim now automatically removes trailing whitespace.

This commit is contained in:
2013-09-15 21:04:27 +02:00
parent 0bb4a1bebd
commit 4e2cc582e1

View File

@@ -72,3 +72,15 @@ set shiftround " always indent/outdent to the nearest tabstop
set expandtab " use spaces instead of tabs
set smarttab " use tabs at the start of a line, spaces elsewhere
set nowrap " don't wrap text
match ErrorMsg '\s\+$' " mark trailing whitespace
" Removes trailing spaces
function! TrimWhiteSpace()
%s/\s\+$//e
endfunction
autocmd FileWritePre * :call TrimWhiteSpace()
autocmd FileAppendPre * :call TrimWhiteSpace()
autocmd FilterWritePre * :call TrimWhiteSpace()
autocmd BufWritePre * :call TrimWhiteSpace()