Created
February 26, 2013 18:37
-
-
Save aaronstaves/5040905 to your computer and use it in GitHub Desktop.
This file contains 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 white space in command mode | |
highlight ExtraWhitespace ctermbg=red guibg=red | |
au ColorScheme * highlight ExtraWhitespace guibg=red | |
au BufEnter * match ExtraWhitespace /\s\+$/ | |
au InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/ | |
au InsertLeave * match ExtraWhiteSpace /\s\+$/ | |
"fix whitespace on write | |
autocmd FileType vim,perl,c,cpp,python,ruby,java autocmd BufWritePre <buffer> :%s/\s\+$//e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Highlights trailing whitespace, and removes it on write