Changes between Initial Version and Version 1 of CodingGuidelines/VIM


Ignore:
Timestamp:
Aug 12, 2009, 11:11:24 AM (15 years ago)
Author:
mmadia
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CodingGuidelines/VIM

    v1 v1  
     1Here 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.
     2I'd like to know if you made improvements on it.
     3
     4{{{
     5autocmd QuickFixCmdPost make cw
     6
     7" autocmd that will set up the w:created variable (vim tip 1598)
     8autocmd VimEnter * autocmd WinEnter * let w:created=1
     9
     10:fu FuncHaikuCheck()
     11       call matchadd('ErrorMsg', '\%>80v.\+', -1) " More than 80 chars on a line
     12       call matchadd('ErrorMsg', '  ', -1) " Two spaces (likely wrong indentation)
     13       call matchadd('ErrorMsg', 'for(', -1) "for without space
     14       call matchadd('ErrorMsg', 'if(', -1) " if without space
     15       call matchadd('ErrorMsg', 'while(', -1) " while without space
     16:endfu
     17
     18" call the function on all opened files
     19autocmd WinEnter * if !exists('w:created') | call FuncHaikuCheck() | endif
     20autocmd BufWinEnter * call FuncHaikuCheck()
     21}}}