26 ms·
I have these in my .vimrc, to display and auto-trim trailing whitespace: augroup trailing_whitespace_show autocmd! " Make trailing whitespa
by cyphar 3y ago
I have these in my .vimrc, to display and auto-trim trailing whitespace:
augroup trailing_whitespace_show
autocmd!
" Make trailing whitespace red.
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
autocmd BufWinEnter,InsertEnter,InsertLeave * match ExtraWhitespace /\s\+$/
" Can slow things down, but show trailing whitespace as red while typing.
autocmd InsertCharPre * match ExtraWhitespace /\s\+$/
augroup END
augroup trailing_whitespace_kill
autocmd!
" Delete all trailing whitespace on-save.
autocmd FileWritePre,FileAppendPre,FilterWritePre,BufWritePre *
\ let w:wv = winsaveview() |
\ :%s/\s\+$//e |
\ call winrestview(w:wv)
augroup END
- cerved 3y agoYou can use listchars trail to show trailing whitespace set listchars+=trail:· set list