perl.vim 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. " Vim Compiler File
  2. " Compiler: Perl syntax checks (perl -Wc)
  3. " Maintainer: Christian J. Robinson <heptite@gmail.com>
  4. " Last Change: 2006 Aug 13
  5. if exists("current_compiler")
  6. finish
  7. endif
  8. let current_compiler = "perl"
  9. if exists(":CompilerSet") != 2 " older Vim always used :setlocal
  10. command -nargs=* CompilerSet setlocal <args>
  11. endif
  12. let s:savecpo = &cpo
  13. set cpo&vim
  14. if exists('g:perl_compiler_force_warnings') && g:perl_compiler_force_warnings == 0
  15. let s:warnopt = 'w'
  16. else
  17. let s:warnopt = 'W'
  18. endif
  19. if getline(1) =~# '-[^ ]*T'
  20. let s:taintopt = 'T'
  21. else
  22. let s:taintopt = ''
  23. endif
  24. exe 'CompilerSet makeprg=perl\ -' . s:warnopt . s:taintopt . 'c\ %'
  25. CompilerSet errorformat=
  26. \%-G%.%#had\ compilation\ errors.,
  27. \%-G%.%#syntax\ OK,
  28. \%m\ at\ %f\ line\ %l.,
  29. \%+A%.%#\ at\ %f\ line\ %l\\,%.%#,
  30. \%+C%.%#
  31. " Explanation:
  32. " %-G%.%#had\ compilation\ errors., - Ignore the obvious.
  33. " %-G%.%#syntax\ OK, - Don't include the 'a-okay' message.
  34. " %m\ at\ %f\ line\ %l., - Most errors...
  35. " %+A%.%#\ at\ %f\ line\ %l\\,%.%#, - As above, including ', near ...'
  36. " %+C%.%# - ... Which can be multi-line.
  37. let &cpo = s:savecpo
  38. unlet s:savecpo