bashate.vim 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. "============================================================================
  2. "File: bashate.vim
  3. "Description: Bash script style checking plugin for syntastic
  4. "License: This program is free software. It comes without any warranty,
  5. " to the extent permitted by applicable law. You can redistribute
  6. " it and/or modify it under the terms of the Do What The Fuck You
  7. " Want To Public License, Version 2, as published by Sam Hocevar.
  8. " See http://sam.zoy.org/wtfpl/COPYING for more details.
  9. "
  10. "============================================================================
  11. if exists('g:loaded_syntastic_sh_bashate_checker')
  12. finish
  13. endif
  14. let g:loaded_syntastic_sh_bashate_checker = 1
  15. let s:save_cpo = &cpo
  16. set cpo&vim
  17. function! SyntaxCheckers_sh_bashate_GetLocList() dict
  18. let makeprg = self.makeprgBuild({})
  19. let errorformat =
  20. \ '%\m%f:%l:%c: %t%n %m,' .
  21. \ '%A%\s%#[%t] E%n: %m,' .
  22. \ '%EE%n: %m,' .
  23. \ '%Z - %f%\s%\+: L%l,' .
  24. \ '%-G%.%#'
  25. let loclist = SyntasticMake({
  26. \ 'makeprg': makeprg,
  27. \ 'errorformat': errorformat,
  28. \ 'subtype': 'Style',
  29. \ 'returns': [0, 1] })
  30. for e in loclist
  31. let e['text'] = substitute(e['text'], "\\m: '.*", '', '')
  32. endfor
  33. return loclist
  34. endfunction
  35. call g:SyntasticRegistry.CreateAndRegisterChecker({
  36. \ 'filetype': 'sh',
  37. \ 'name': 'bashate' })
  38. let &cpo = s:save_cpo
  39. unlet s:save_cpo
  40. " vim: set sw=4 sts=4 et fdm=marker: