Vim now automatically removes trailing whitespace.
This commit is contained in:
12
vim/vimrc
12
vim/vimrc
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user