|Version 4 (modified by 10 years ago) ( diff ),|
Here is a small script that will detect some guideline violations for vim. I put it in my .vimrc and it highlight all the errors it can find in all opened files. I'd like to know if you made improvements on it.
" autocmd that will set up the w:created variable (vim tip 1598) " so we can run the check only once per window autocmd VimEnter * autocmd WinEnter * let w:created=1 :fu FuncHaikuCheck() call matchadd('Search', '\%>80v.\+', -1) " line with more than 80 chars call matchadd('Search', ' ', -1) " probably wrong indenting call matchadd('Search', '\(for\|if\|select\|while\)(', -1) "keyword without space after it call matchadd('Search', '[a-zA-Z0-9][,=<>/+\-*;][a-zA-Z0-9]', -1) "operator without space around it call matchadd('Search', '[^*/][,=/+\-* ]$', -1) "operator at end of line (without false positives on /* and */) :endfu " call the function on all opened files autocmd WinEnter * if !exists('w:created') | call FuncHaikuCheck() | endif autocmd BufWinEnter * call FuncHaikuCheck()