checkbashisms.vim 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. "============================================================================
  2. "File: checkbashisms.vim
  3. "Description: Shell script syntax/style checking plugin for syntastic.vim
  4. "Notes: checkbashisms.pl can be downloaded from
  5. " http://debian.inode.at/debian/pool/main/d/devscripts/
  6. " as part of the devscripts package.
  7. "============================================================================
  8. if exists('g:loaded_syntastic_sh_checkbashisms_checker')
  9. finish
  10. endif
  11. let g:loaded_syntastic_sh_checkbashisms_checker = 1
  12. let s:save_cpo = &cpo
  13. set cpo&vim
  14. function! SyntaxCheckers_sh_checkbashisms_GetLocList() dict
  15. let makeprg = self.makeprgBuild({ 'args': '-fx' })
  16. let errorformat =
  17. \ '%-Gscript %f is already a bash script; skipping,' .
  18. \ '%Eerror: %f: %m\, opened in line %l,' .
  19. \ '%Eerror: %f: %m,' .
  20. \ '%Ecannot open script %f for reading: %m,' .
  21. \ '%Wscript %f %m,%C%.# lines,' .
  22. \ '%Wpossible bashism in %f line %l (%m):,%C%.%#,%Z.%#,' .
  23. \ '%-G%.%#'
  24. return SyntasticMake({
  25. \ 'makeprg': makeprg,
  26. \ 'errorformat': errorformat,
  27. \ 'subtype': 'Style' })
  28. endfunction
  29. call g:SyntasticRegistry.CreateAndRegisterChecker({
  30. \ 'filetype': 'sh',
  31. \ 'name': 'checkbashisms' })
  32. let &cpo = s:save_cpo
  33. unlet s:save_cpo
  34. " vim: set sw=4 sts=4 et fdm=marker: