|Version 2 (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('ErrorMsg', '\%>80v.\+', -1) " More than 80 chars on a line call matchadd('ErrorMsg', ' ', -1) " Two spaces (likely wrong indentation) call matchadd('ErrorMsg', 'for(', -1) "for without space call matchadd('ErrorMsg', 'if(', -1) " if without space call matchadd('ErrorMsg', 'while(', -1) " while without space :endfu " call the function on all opened files autocmd WinEnter * if !exists('w:created') | call FuncHaikuCheck() | endif autocmd BufWinEnter * call FuncHaikuCheck()