Skip to content

Improve generic compiler backend #2021

@lervag

Description

@lervag

The generic compiler backend was added after discussion in #1898. See also slightly related issue #1797. For convenience, this is a list of things to improve:

  • Allow callback hooks similar to the latexmk backend.
  • Documentation:
    • Ensure proper documentation; see e.g. the hooks key in help text for g:vimtex_compiler_latexmk.
    • Add configuration examples to section vimtex-compiler-generic.
    • Extra: Use more consistent section names like vimtex-compiler-latexmk and vimtex-compiler-generic.

Callback hook

function! MyCustomCallback(msg) abort
  if condition(a:msg)
    call vimtex#compiler#callback(!vimtex#qf#inquire(b:vimtex.tex))
  endif
endfunction

let g:vimtex_compiler_generic = {
      \ 'cmd': 'ls *.tex | entr -c tectonic /_ --synctex --keep-logs',
      \ 'hooks': [function('MyCustomCallback')],
      \}

Examples

let g:vimtex_compiler_method='generic'

" Tectonic does not do continuous compilation, so this may work as
" a custom continuous version
let g:vimtex_compiler_generic = {
      \ 'cmd': 'ls *.tex | entr -c tectonic /_ --synctex --keep-logs',
      \}

" This is not really useful, but serves as an example
let g:vimtex_compiler_generic = {
      \ 'cmd': 'ls *.tex | entr -c latexmk',
      \}

" Makefile based workflow
let g:vimtex_compiler_generic = {
      \ 'cmd': 'make',
      \}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions