perl.vim 1.4 KB

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