diff options
author | Anna “CyberTailor” <cyber@sysrq.in> | 2021-07-13 16:30:54 +0500 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2021-07-13 13:38:42 +0200 |
commit | f3966209e5941ee3139425c5e375d373c1026923 (patch) | |
tree | ab6d6ecc6d5eb5fa42fd1a45527deaec6a24f322 /contrib | |
parent | a556718a24d003523b7fb0406061e7f89291b14e (diff) |
contrib/vim: add Syntastic integration
Error and warning messages are prefixed with "error: " and "warning: "
correspondingly to ease integration with automated tooling.
`yywarn' function added. Off-by-one line numbers in warnings are fixed.
Two error messages are reworded to avoid repeating like
"error: error in server directive" or "error: syntax error".
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/README | 6 | ||||
-rw-r--r-- | contrib/vim/syntax_checkers/gmid/gmid.vim | 36 |
2 files changed, 41 insertions, 1 deletions
diff --git a/contrib/README b/contrib/README index c57932c..ab45f9b 100644 --- a/contrib/README +++ b/contrib/README @@ -16,4 +16,8 @@ gmid.service vim Syntax highlighting of gmid configuration for vim, to be - placed into ~/.vim/ or /usr/share/vim/vimfiles. + placed into ~/.vim/ or /usr/share/vim/vimfiles/. + + To enable Syntastic checker, put this line in your vimrc: + + let g:syntastic_gmid_checkers = ['gmid'] diff --git a/contrib/vim/syntax_checkers/gmid/gmid.vim b/contrib/vim/syntax_checkers/gmid/gmid.vim new file mode 100644 index 0000000..d3187ee --- /dev/null +++ b/contrib/vim/syntax_checkers/gmid/gmid.vim @@ -0,0 +1,36 @@ +" Syntax checking plugin for syntastic +" Language: gmid(1) configuration file +" Licence: ISC + +if exists('g:loaded_syntastic_gmid_gmid_checker') + finish +endif +let g:loaded_syntastic_gmid_gmid_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_gmid_gmid_GetLocList() dict + let makeprg = self.makeprgBuild({ 'args': '-nc' }) + + let errorformat = + \ '%-Gconfig OK,' . + \ '%f:%l %tarning: %m,' . + \ '%f:%l %trror: %m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'type': 'E'}, + \ 'returns': [0, 1] }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'gmid', + \ 'name': 'gmid', + \ 'exec': 'gmid'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: |