Skip to content

Instantly share code, notes, and snippets.

@Milly
Created February 10, 2010 08:29
Show Gist options
  • Save Milly/300141 to your computer and use it in GitHub Desktop.
Save Milly/300141 to your computer and use it in GitHub Desktop.
Add highlight for spaces.
" Vim plugin file - highlight_spaces
"
" Last Change: 08 February 2010
" Maintainer: Milly
" Purpose: Add highlight for spaces.
"=============================================================================
if exists("loaded_highlight_spaces")
finish
endif
if has('syntax') && has('iconv')
function! s:HighlightSpaces()
if &buftype == ""
syntax match FullWidthSpace " " display containedin=ALL
highlight FullWidthSpace ctermbg=darkgrey guibg=#555555
syntax match TrailedSpaces "\s\+$" display containedin=ALL
highlight TrailedSpaces ctermbg=grey guibg=#666666
endif
endf
augroup highlight_spaces
au!
au BufNew,BufRead,FileType,ColorScheme * call s:HighlightSpaces()
augroup END
endif
let loaded_highlight_spaces=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment