vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

tex.vim (2019B)


      1 " Vim compiler file
      2 " Compiler:     TeX
      3 " Maintainer:   Artem Chuprina <ran@ran.pp.ru>
      4 " Contributors: Enno Nagel
      5 " Last Change:  2024 Mar 29
      6 "		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)
      9 "		2025 Mar 11 by the Vim Project (add comment for Dispatch)
     10 
     11 if exists("current_compiler")
     12 	finish
     13 endif
     14 let s:keepcpo= &cpo
     15 set cpo&vim
     16 
     17 " If makefile exists and we are not asked to ignore it, we use standard make
     18 " (do not redefine makeprg)
     19 if 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,
     22 	" otherwise the same for global variable with same name, else it will be
     23 	" 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
     31 	let s:makeprg=current_compiler .. ' -interaction=nonstopmode'
     32 	" CompilerSet makeprg=latex
     33 	execute 'CompilerSet makeprg=' .. escape(s:makeprg, ' \|"')
     34 else
     35 	let current_compiler = 'make'
     36 endif
     37 
     38 " Value errorformat are taken from vim help, see :help errorformat-LaTeX, with
     39 " addition from Srinath Avadhanula <srinath@fastmail.fm>
     40 CompilerSet 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 
     69 let &cpo = s:keepcpo
     70 unlet s:keepcpo