adrianchadd:vimhighlights

Vim highlights for editing code

This is my .vimrc . It's inspired by some rules given to me by Bernhard Schmidt <bschmidt@freebsd.org>.

  • Tab characters are marked as blue '>';
  • Tab spaces (ie, the filler between the tab character and the first non-whitespace character) are marked as blue '.';
  • Characters between positions 78 and 80 are highlighted in magenta;
  • Characters in position 80 and later are highlighted in red;
  • Trailing whitespace is marked as a blue 'C'.

This helps find and fix whitespace, indenting and code width issues when hacking on BSD code.

" LCD-friendly!
:set bg=dark

" Do general syntax highlighting
:syntax enable

" Highlight tab characters as >. (with . being tab spaces)
" Highlight extra spaces (ie, before the end of line) with "C"
:set list
:set listchars=tab:>.,trail:C

:highlight NearLength ctermbg=magenta ctermfg=white guibg=#592959
:highlight OverLength ctermbg=red ctermfg=white guibg=#592929
" Match characters after position 78; set highlight to be magenta
" Second match characters after position 80; set highlight to be red
:match NearLength /\%78v.\+/
:2match OverLength /\%81v.\+/

" Enable auto-indenting
:set ai
  • adrianchadd/vimhighlights.txt
  • Last modified: 2012/01/16 17:49
  • by AdrianChadd