|
| 1 | +"============================================================================ |
| 2 | +"File: pc_lint.vim |
| 3 | +"Description: Syntax checking plugin for syntastic.vim |
| 4 | +"Maintainer: Steve Bragg <steve at empresseffects dot com> |
| 5 | +"License: This program is free software. It comes without any warranty, |
| 6 | +" to the extent permitted by applicable law. You can redistribute |
| 7 | +" it and/or modify it under the terms of the Do What The Fuck You |
| 8 | +" Want To Public License, Version 2, as published by Sam Hocevar. |
| 9 | +" See http://sam.zoy.org/wtfpl/COPYING for more details. |
| 10 | +" |
| 11 | +"============================================================================ |
| 12 | + |
| 13 | +if exists("g:loaded_syntastic_c_pc_lint_checker") |
| 14 | + finish |
| 15 | +endif |
| 16 | +let g:loaded_syntastic_c_pc_lint_checker = 1 |
| 17 | + |
| 18 | +let s:save_cpo = &cpo |
| 19 | +set cpo&vim |
| 20 | + |
| 21 | +" stolen from c.vim of syntastic |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | +function! getLintFile(file) |
| 27 | + " search in the current file's directory upwards |
| 28 | + let config = findfile(a:file, '.;') |
| 29 | + if config == '' || !filereadable(config) |
| 30 | + return '' |
| 31 | + endif |
| 32 | + |
| 33 | + " convert filename into absolute path |
| 34 | + return '-i"' . fnamemodify(config, ':p:h') . '"' |
| 35 | +endfunction |
| 36 | + |
| 37 | + |
| 38 | +if !exists('g:syntastic_pc_lint_config_file') |
| 39 | + let g:syntastic_pc_lint_config_file = '.lnt' |
| 40 | +endif |
| 41 | + |
| 42 | +function! SyntaxCheckers_c_pc_lint_GetLocList() dict |
| 43 | + " gotta add something about the options file |
| 44 | + let makeprg = self.makeprgBuild({ |
| 45 | + \ 'args': ' -hF1 -width(0,0)' }) |
| 46 | + |
| 47 | + let errorformat = |
| 48 | + \ '%f %l %trror %n: %m,' . |
| 49 | + \ '%f %l %tarning %n: %m,' . |
| 50 | + \ '%f %l %tnfo %n: %m' |
| 51 | + |
| 52 | + return SyntasticMake({ |
| 53 | + \ 'makeprg': makeprg, |
| 54 | + \ 'errorformat': errorformat }) |
| 55 | +endfunction |
| 56 | + |
| 57 | +call g:SyntasticRegistry.CreateAndRegisterChecker({ |
| 58 | + \ 'filetype': 'c', |
| 59 | + \ 'name': 'pc_lint', |
| 60 | + \ 'exec': 'lint-nt'}) |
| 61 | + |
| 62 | +let &cpo = s:save_cpo |
| 63 | +unlet s:save_cpo |
| 64 | + |
| 65 | +" vim: set et sts=4 sw=4: |
0 commit comments