Skip to content

Instantly share code, notes, and snippets.

@JessieAMorris
Created August 6, 2014 21:28
Show Gist options
  • Save JessieAMorris/02d992f9fd363183c440 to your computer and use it in GitHub Desktop.
Save JessieAMorris/02d992f9fd363183c440 to your computer and use it in GitHub Desktop.
Highligh mixed tabs & spaces
highlight MixedIndent ctermbg = red guibg = #FF0000
" Executes all auto commands
function! <SID>SetupAutoCommands()
" Auto commands group
augroup better_whitespace
autocmd!
" Highlight extraneous whitespace at the end of lines, but not the
" current line
syn clear MixedIndent | syn match MixedIndent excludenl /\v^\s*( \t|\t )\s*/
autocmd InsertEnter * syn clear MixedIndent | syn match MixedIndent excludenl /\v^\s*( \t|\t )\s*\%#\@!/ containedin=ALL
autocmd InsertLeave,BufReadPost * syn clear MixedIndent | syn match MixedIndent excludenl /\v^\s*( \t|\t )\s*/ containedin=ALL
augroup END
endfunction
" Initial call to setup autocommands
call <SID>SetupAutoCommands()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment