commit f15a31ff4600476db90cae8417f6bfa5cde2b8b5 parent a370f61647ba3ee438b7f3a4d1952417a5751e72 Author: Ed van Bruggen <ed@edryd.org> Date: Mon, 18 Sep 2017 13:02:11 -0700 vim: Clear trailing whitespace on save Diffstat:
vimrc | | | 13 | ++++++++----- |
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/vimrc b/vimrc @@ -173,12 +173,15 @@ set listchars=tab:\|\ ,eol:¬,extends:❯,precedes:❮ " make Vim's clipboard the same as OS's clipboard let g:clipbrdDefaultReg = '+' -" make Vim save every time it leaves insert mode -au InsertLeave * if &mod && expand('%')!=''|write|endif - -" save line number line when reopening file if has("autocmd") - au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif + " make Vim save every time it leaves insert mode + autocmd InsertLeave * if &mod && expand('%')!=''|write|endif + + " save line number line when reopening file + autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif + + " remove trailing whitespace + autocmd BufWritePre * %s/\s\+$//e endif " turn on alt key