mirror of
https://github.com/bronson/vim-trailing-whitespace.git
synced 2025-11-08 11:33:54 -05:00
12 lines
644 B
VimL
12 lines
644 B
VimL
" Highlight EOL whitespace, http://vim.wikia.com/wiki/Highlight_unwanted_spaces
|
|
highlight ExtraWhitespace ctermbg=darkred guibg=#382424
|
|
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
|
|
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
|
|
" the above flashes annoyingly while typing, be calmer in insert mode
|
|
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
|
|
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
|
|
|
|
" Run :FixWhitespace to remove end of line white space.
|
|
command! -range=% FixWhitespace silent! let savesearch = @/ | keepjumps <line1>,<line2>substitute/\s\+$// | let @/ = savesearch | unlet savesearch
|
|
|