tex.vim 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. " Vim compiler file
  2. " Compiler: TeX
  3. " Maintainer: Artem Chuprina <ran@ran.pp.ru>
  4. " Last Change: 2012 Apr 30
  5. if exists("current_compiler")
  6. finish
  7. endif
  8. let s:keepcpo= &cpo
  9. set cpo&vim
  10. if exists(":CompilerSet") != 2 " older Vim always used :setlocal
  11. command -nargs=* CompilerSet setlocal <args>
  12. endif
  13. " If makefile exists and we are not asked to ignore it, we use standard make
  14. " (do not redefine makeprg)
  15. if exists('b:tex_ignore_makefile') || exists('g:tex_ignore_makefile') ||
  16. \(!filereadable('Makefile') && !filereadable('makefile'))
  17. " If buffer-local variable 'tex_flavor' exists, it defines TeX flavor,
  18. " otherwise the same for global variable with same name, else it will be
  19. " LaTeX
  20. if exists("b:tex_flavor")
  21. let current_compiler = b:tex_flavor
  22. elseif exists("g:tex_flavor")
  23. let current_compiler = g:tex_flavor
  24. else
  25. let current_compiler = "latex"
  26. endif
  27. let &l:makeprg=current_compiler.' -interaction=nonstopmode'
  28. else
  29. let current_compiler = 'make'
  30. endif
  31. " Value errorformat are taken from vim help, see :help errorformat-LaTeX, with
  32. " addition from Srinath Avadhanula <srinath@fastmail.fm>
  33. CompilerSet errorformat=%E!\ LaTeX\ %trror:\ %m,
  34. \%E!\ %m,
  35. \%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#,
  36. \%+W%.%#\ at\ lines\ %l--%*\\d,
  37. \%WLaTeX\ %.%#Warning:\ %m,
  38. \%Cl.%l\ %m,
  39. \%+C\ \ %m.,
  40. \%+C%.%#-%.%#,
  41. \%+C%.%#[]%.%#,
  42. \%+C[]%.%#,
  43. \%+C%.%#%[{}\\]%.%#,
  44. \%+C<%.%#>%.%#,
  45. \%C\ \ %m,
  46. \%-GSee\ the\ LaTeX%m,
  47. \%-GType\ \ H\ <return>%m,
  48. \%-G\ ...%.%#,
  49. \%-G%.%#\ (C)\ %.%#,
  50. \%-G(see\ the\ transcript%.%#),
  51. \%-G\\s%#,
  52. \%+O(%*[^()])%r,
  53. \%+O%*[^()](%*[^()])%r,
  54. \%+P(%f%r,
  55. \%+P\ %\\=(%f%r,
  56. \%+P%*[^()](%f%r,
  57. \%+P[%\\d%[^()]%#(%f%r,
  58. \%+Q)%r,
  59. \%+Q%*[^()])%r,
  60. \%+Q[%\\d%*[^()])%r
  61. let &cpo = s:keepcpo
  62. unlet s:keepcpo