Created
April 11, 2014 18:01
-
-
Save codeprimate/10488394 to your computer and use it in GitHub Desktop.
Vim: Highlight trailing white space
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Highlight trailing whitespace | |
highlight ExtraWhitespace ctermbg=red guibg=red | |
match ExtraWhitespace /\s\+$/ | |
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/ | |
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/ | |
autocmd InsertLeave * match ExtraWhitespace /\s\+$/ | |
autocmd BufWinLeave * call clearmatches() | |
function! TrimWhiteSpace() | |
%s/\s\+$//e | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment