Added latexmk callback hook (#383)

This commit is contained in:
Karl Yngve Lervåg 2016-02-28 21:36:53 +01:00
parent ec5e0df360
commit 033da30308
2 changed files with 22 additions and 0 deletions

View File

@ -13,6 +13,7 @@ function! vimtex#latexmk#init_options() " {{{1
call vimtex#util#set_default('g:vimtex_latexmk_background', 0)
call vimtex#util#set_default('g:vimtex_latexmk_callback', 1)
call vimtex#util#set_default('g:vimtex_latexmk_callback_hook', '')
call vimtex#util#set_default('g:vimtex_latexmk_continuous', 1)
call vimtex#util#set_default('g:vimtex_latexmk_file_line_error', 1)
call vimtex#util#set_default('g:vimtex_latexmk_options', '')
@ -105,6 +106,11 @@ function! vimtex#latexmk#callback(status) " {{{1
call vimtex#echo#status(['latexmk compile: ',
\ a:status ? ['VimtexSuccess', 'success'] : ['VimtexWarning', 'fail']])
try
call call(g:vimtex_latexmk_callback_hook, [a:status])
catch /.*/
endtry
return ''
endfunction

View File

@ -630,6 +630,21 @@ Options~
Default value: 1
*g:vimtex_latexmk_callback_hook*
If defined and given the name of a function, it will be called from the
vimtex latexmk callback with the status as the sole argument. This allows
users to add custom callback functionality.
Example: >
let g:vimtex_latexmk_callback_hook = 'MyTestHook'
function! MyTestHook(status)
echom a:status
endfunction
< Default value: ''
*g:vimtex_latexmk_continuous*
If enabled, `latexmk` will run in continuous mode, i.e. with the `-pvc`
argument. This means that the document is compiled every time a document
@ -1626,6 +1641,7 @@ with |VimtexErrors|.
Associated settings:
|g:vimtex_latexmk_enabled|
|g:vimtex_latexmk_callback|
|g:vimtex_latexmk_callback_hook|
|g:vimtex_latexmk_autojump|
|g:vimtex_latexmk_continuous|
|g:vimtex_latexmk_background|