Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Apr 2011 19:15:43 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        FreeBSD Hackers <freebsd-hackers@FreeBSD.org>
Subject:   couple more vim gems for C/FreeBSD hackers
Message-ID:  <4DA5CC2F.9010506@FreeBSD.org>

next in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4DA5CC2F.9010506>