couple more vim gems for C/FreeBSD hackers

Andriy Gapon avg at FreeBSD.org
Wed Apr 13 16:14:25 UTC 2011


This is for your .vimrc.
Picked from some google search results.

" highlight too long lines
autocmd BufWinEnter *.c let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
autocmd BufWinLeave *.c call matchdelete(w:m2)

" permanently highlight 80th column
" set colorcolumn=80

" highlight trailing whitespace and tabs after spaces in leading whitespace
highlight ExtraWhitespace ctermbg=red guibg=red
autocmd BufWinEnter *.c match ExtraWhitespace /^\s* 	\|\s\+$/
autocmd InsertEnter *.c match ExtraWhitespace /^\s* 	\|\s\+\%#\@<!$/
autocmd InsertLeave *.c match ExtraWhitespace /^\s* 	\|\s\+$/
autocmd BufWinLeave *.c call clearmatches()

-- 
Andriy Gapon


More information about the freebsd-hardware mailing list