blob: 529f7f7710cfe11d001dcd666dbd8658decbf4fa [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
Konfekt4927dae2024-11-19 22:41:14 +01006" 2024 Apr 03 by the Vim Project (removed :CompilerSet definition)
7" 2024 Apr 05 by the Vim Project (avoid leaving behind g:makeprg)
8" 2024 Nov 19 by the Vim Project (properly escape makeprg setting)
Konfekt4fa2dd22025-03-11 21:35:48 +01009" 2025 Mar 11 by the Vim Project (add comment for Dispatch)
Bram Moolenaar071d4272004-06-13 20:20:40 +000010
11if exists("current_compiler")
12 finish
13endif
Bram Moolenaar9a7224b2012-04-30 15:56:52 +020014let s:keepcpo= &cpo
15set cpo&vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000016
Bram Moolenaar071d4272004-06-13 20:20:40 +000017" 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
zeertzjqb73faa12024-04-06 02:01:16 +080031 let s:makeprg=current_compiler .. ' -interaction=nonstopmode'
Konfekt4fa2dd22025-03-11 21:35:48 +010032 " CompilerSet makeprg=latex
Konfekt4927dae2024-11-19 22:41:14 +010033 execute 'CompilerSet makeprg=' .. escape(s:makeprg, ' \|"')
Bram Moolenaar071d4272004-06-13 20:20:40 +000034else
35 let current_compiler = 'make'
36endif
37
Bram Moolenaar071d4272004-06-13 20:20:40 +000038" Value errorformat are taken from vim help, see :help errorformat-LaTeX, with
39" addition from Srinath Avadhanula <srinath@fastmail.fm>
40CompilerSet errorformat=%E!\ LaTeX\ %trror:\ %m,
41 \%E!\ %m,
42 \%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#,
43 \%+W%.%#\ at\ lines\ %l--%*\\d,
44 \%WLaTeX\ %.%#Warning:\ %m,
45 \%Cl.%l\ %m,
46 \%+C\ \ %m.,
47 \%+C%.%#-%.%#,
48 \%+C%.%#[]%.%#,
49 \%+C[]%.%#,
50 \%+C%.%#%[{}\\]%.%#,
51 \%+C<%.%#>%.%#,
52 \%C\ \ %m,
53 \%-GSee\ the\ LaTeX%m,
54 \%-GType\ \ H\ <return>%m,
55 \%-G\ ...%.%#,
56 \%-G%.%#\ (C)\ %.%#,
57 \%-G(see\ the\ transcript%.%#),
58 \%-G\\s%#,
59 \%+O(%*[^()])%r,
60 \%+O%*[^()](%*[^()])%r,
61 \%+P(%f%r,
62 \%+P\ %\\=(%f%r,
63 \%+P%*[^()](%f%r,
64 \%+P[%\\d%[^()]%#(%f%r,
65 \%+Q)%r,
66 \%+Q%*[^()])%r,
67 \%+Q[%\\d%*[^()])%r
68
Bram Moolenaar9a7224b2012-04-30 15:56:52 +020069let &cpo = s:keepcpo
70unlet s:keepcpo