1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
" VimTeX - LaTeX plugin for Vim
"
" Maintainer: Karl Yngve LervÄg
" Email: karl.yngve@gmail.com
"
function! vimtex#compiler#latexrun#init(options) abort " {{{1
return s:compiler.new(a:options)
endfunction
" }}}1
let s:compiler = vimtex#compiler#_template#new({
\ 'name' : 'latexrun',
\ 'options' : [
\ '--verbose-cmds',
\ '--latex-args="-synctex=1"',
\ ],
\})
function! s:compiler.__check_requirements() abort dict " {{{1
if !executable('latexrun')
call vimtex#log#warning('latexrun is not executable!')
let self.enabled = v:false
endif
endfunction
" }}}1
function! s:compiler.__build_cmd(passed_options) abort dict " {{{1
return 'latexrun ' . join(self.options)
\ . ' --latex-cmd ' . self.get_engine()
\ . ' -O '
\ . (empty(self.out_dir) ? '.' : fnameescape(self.out_dir))
\ . a:passed_options
\ . ' ' . vimtex#util#shellescape(self.file_info.target_basename)
endfunction
" }}}1
function! s:compiler.clean(...) abort dict " {{{1
let l:cmd = printf('latexrun --clean-all -O %s',
\ empty(self.out_dir) ? '.' : fnameescape(self.out_dir))
call vimtex#jobs#run(l:cmd, {'cwd': self.file_info.root})
endfunction
" }}}1
function! s:compiler.get_engine() abort dict " {{{1
return get(g:vimtex_compiler_latexrun_engines,
\ b:vimtex.get_tex_program(),
\ g:vimtex_compiler_latexrun_engines._)
endfunction
" }}}1
|