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