sqlint.vim 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. "============================================================================
  2. "File: sqlint.vim
  3. "Description: Syntax checking plugin for syntastic.vim
  4. "Maintainer: Steve Purcell <steve@sanityinc.com>
  5. "License: MIT
  6. "============================================================================
  7. if exists('g:loaded_syntastic_sql_sqlint_checker')
  8. finish
  9. endif
  10. let g:loaded_syntastic_sql_sqlint_checker = 1
  11. let s:save_cpo = &cpo
  12. set cpo&vim
  13. function! SyntaxCheckers_sql_sqlint_GetHighlightRegex(i)
  14. let term = matchstr(a:i['text'], '\m at or near "\zs[^"]\+\ze"')
  15. return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
  16. endfunction
  17. function! SyntaxCheckers_sql_sqlint_IsAvailable() dict
  18. if !executable(self.getExec())
  19. return 0
  20. endif
  21. return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 0, 3])
  22. endfunction
  23. function! SyntaxCheckers_sql_sqlint_GetLocList() dict
  24. let makeprg = self.makeprgBuild({})
  25. let errorformat =
  26. \ '%E%f:%l:%c:ERROR %m,' .
  27. \ '%W%f:%l:%c:WARNING %m,' .
  28. \ '%C %m'
  29. return SyntasticMake({
  30. \ 'makeprg': makeprg,
  31. \ 'errorformat': errorformat,
  32. \ 'subtype': 'Style',
  33. \ 'returns': [0, 1] })
  34. endfunction
  35. call g:SyntasticRegistry.CreateAndRegisterChecker({
  36. \ 'filetype': 'sql',
  37. \ 'name': 'sqlint'})
  38. let &cpo = s:save_cpo
  39. unlet s:save_cpo
  40. " vim: set sw=4 sts=4 et fdm=marker: