Move errorformat to compiler file

This commit is contained in:
Karl Yngve Lervåg 2015-02-10 11:29:29 +01:00
parent c6c5d78af9
commit dde6dcad2d
3 changed files with 54 additions and 48 deletions

View File

@ -10,7 +10,6 @@ let s:initialized = 0
function! latex#init() " {{{1
call s:init_options()
call s:init_environment()
call s:init_errorformat()
call latex#toc#init(s:initialized)
call latex#fold#init(s:initialized)
@ -154,53 +153,6 @@ function! s:init_environment() " {{{1
nnoremap <buffer> <plug>(vl-reinit) :call latex#reinit()<cr>
endfunction
function! s:init_errorformat() " {{{1
"
" Note: The error formats assume we're using the -file-line-error with
" [pdf]latex. For more info, see |errorformat-LaTeX|.
"
" Push file to file stack
setlocal efm=%-P**%f
setlocal efm+=%-P**\"%f\"
" Match errors
setlocal efm+=%E!\ LaTeX\ %trror:\ %m
setlocal efm+=%E%f:%l:\ %m
setlocal efm+=%E!\ %m
" More info for undefined control sequences
setlocal efm+=%Z<argument>\ %m
" More info for some errors
setlocal efm+=%Cl.%l\ %m
" Show warnings
if ! g:latex_quickfix_ignore_all_warnings
" Ignore some warnings
for w in g:latex_quickfix_ignored_warnings
let warning = escape(substitute(w, '[\,]', '%\\\\&', 'g'), ' ')
exe 'setlocal efm+=%-G%.%#'. warning .'%.%#'
endfor
setlocal efm+=%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#
setlocal efm+=%+W%.%#\ at\ lines\ %l--%*\\d
setlocal efm+=%+WLaTeX\ %.%#Warning:\ %m
setlocal efm+=%+W%.%#%.%#Warning:\ %m
" Parse biblatex warnings
setlocal efm+=%-C(biblatex)%.%#in\ t%.%#
setlocal efm+=%-C(biblatex)%.%#Please\ v%.%#
setlocal efm+=%-C(biblatex)%.%#LaTeX\ a%.%#
setlocal efm+=%-Z(biblatex)%m
" Parse hyperref warnings
setlocal efm+=%-C(hyperref)%.%#on\ input\ line\ %l.
endif
" Ignore unmatched lines
setlocal efm+=%-G%.%#
endfunction
" }}}1
function! s:init_options() " {{{1
call latex#util#set_default('g:latex_quickfix_ignore_all_warnings', 0)
call latex#util#set_default('g:latex_quickfix_ignored_warnings', [])

View File

@ -25,6 +25,9 @@ function! latex#latexmk#init(initialized) " {{{1
" Check system compatibility
if s:system_incompatible() | return | endif
" Set compiler (this defines the errorformat)
compiler latexmk
" Initialize pid for current tex file
if !has_key(g:latex#data[b:latex.id], 'pid')
let g:latex#data[b:latex.id].pid = 0

51
compiler/latexmk.vim Normal file
View File

@ -0,0 +1,51 @@
if exists("current_compiler") | finish | endif
let current_compiler = "latexmk"
CompilerSet makeprg=""
"
" Note: The errorformat assumes we're using the -file-line-error with
" [pdf]latex. For more info, see |errorformat-LaTeX|.
"
" Push file to file stack
CompilerSet errorformat=%-P**%f
CompilerSet errorformat+=%-P**\"%f\"
" Match errors
CompilerSet errorformat+=%E!\ LaTeX\ %trror:\ %m
CompilerSet errorformat+=%E%f:%l:\ %m
CompilerSet errorformat+=%E!\ %m
" More info for undefined control sequences
CompilerSet errorformat+=%Z<argument>\ %m
" More info for some errors
CompilerSet errorformat+=%Cl.%l\ %m
" Show warnings
if exists("g:latex_quickfix_ignore_all_warnings")
\ && exists("g:latex_quickfix_ignored_warnings")
\ && !g:latex_quickfix_ignore_all_warnings
" Ignore some warnings
for w in g:latex_quickfix_ignored_warnings
let warning = escape(substitute(w, '[\,]', '%\\\\&', 'g'), ' ')
exe 'CompilerSet errorformat+=%-G%.%#'. warning .'%.%#'
endfor
CompilerSet errorformat+=%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#
CompilerSet errorformat+=%+W%.%#\ at\ lines\ %l--%*\\d
CompilerSet errorformat+=%+WLaTeX\ %.%#Warning:\ %m
CompilerSet errorformat+=%+W%.%#%.%#Warning:\ %m
" Parse biblatex warnings
CompilerSet errorformat+=%-C(biblatex)%.%#in\ t%.%#
CompilerSet errorformat+=%-C(biblatex)%.%#Please\ v%.%#
CompilerSet errorformat+=%-C(biblatex)%.%#LaTeX\ a%.%#
CompilerSet errorformat+=%-Z(biblatex)%m
" Parse hyperref warnings
CompilerSet errorformat+=%-C(hyperref)%.%#on\ input\ line\ %l.
endif
" Ignore unmatched lines
CompilerSet errorformat+=%-G%.%#