blob: 0925d176808ce9ec064d095c70cb1061d46faf35 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim compiler file
2" Compiler: TeX
3" Maintainer: Artem Chuprina <ran@ran.pp.ru>
Enno18d730d2024-03-31 18:37:05 +02004" Contributors: Enno Nagel
5" Last Change: 2024 Mar 29
Bram Moolenaar071d4272004-06-13 20:20:40 +00006
7if exists("current_compiler")
8 finish
9endif
Bram Moolenaar9a7224b2012-04-30 15:56:52 +020010let s:keepcpo= &cpo
11set cpo&vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000012
13if exists(":CompilerSet") != 2 " older Vim always used :setlocal
14 command -nargs=* CompilerSet setlocal <args>
15endif
16
17" If makefile exists and we are not asked to ignore it, we use standard make
18" (do not redefine makeprg)
19if exists('b:tex_ignore_makefile') || exists('g:tex_ignore_makefile') ||
20 \(!filereadable('Makefile') && !filereadable('makefile'))
21 " If buffer-local variable 'tex_flavor' exists, it defines TeX flavor,
Bram Moolenaar6c391a72021-09-09 21:55:11 +020022 " otherwise the same for global variable with same name, else it will be
Bram Moolenaar071d4272004-06-13 20:20:40 +000023 " LaTeX
24 if exists("b:tex_flavor")
25 let current_compiler = b:tex_flavor
26 elseif exists("g:tex_flavor")
27 let current_compiler = g:tex_flavor
28 else
29 let current_compiler = "latex"
30 endif
Enno18d730d2024-03-31 18:37:05 +020031 let makeprg=current_compiler .. ' -interaction=nonstopmode'
32 execute 'CompilerSet makeprg=' .. escape(makeprg, ' ')
Bram Moolenaar071d4272004-06-13 20:20:40 +000033else
34 let current_compiler = 'make'
35endif
36
Bram Moolenaar071d4272004-06-13 20:20:40 +000037" Value errorformat are taken from vim help, see :help errorformat-LaTeX, with
38" addition from Srinath Avadhanula <srinath@fastmail.fm>
39CompilerSet errorformat=%E!\ LaTeX\ %trror:\ %m,
40 \%E!\ %m,
41 \%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#,
42 \%+W%.%#\ at\ lines\ %l--%*\\d,
43 \%WLaTeX\ %.%#Warning:\ %m,
44 \%Cl.%l\ %m,
45 \%+C\ \ %m.,
46 \%+C%.%#-%.%#,
47 \%+C%.%#[]%.%#,
48 \%+C[]%.%#,
49 \%+C%.%#%[{}\\]%.%#,
50 \%+C<%.%#>%.%#,
51 \%C\ \ %m,
52 \%-GSee\ the\ LaTeX%m,
53 \%-GType\ \ H\ <return>%m,
54 \%-G\ ...%.%#,
55 \%-G%.%#\ (C)\ %.%#,
56 \%-G(see\ the\ transcript%.%#),
57 \%-G\\s%#,
58 \%+O(%*[^()])%r,
59 \%+O%*[^()](%*[^()])%r,
60 \%+P(%f%r,
61 \%+P\ %\\=(%f%r,
62 \%+P%*[^()](%f%r,
63 \%+P[%\\d%[^()]%#(%f%r,
64 \%+Q)%r,
65 \%+Q%*[^()])%r,
66 \%+Q[%\\d%*[^()])%r
67
Bram Moolenaar9a7224b2012-04-30 15:56:52 +020068let &cpo = s:keepcpo
69unlet s:keepcpo