diff --git a/autoload/vimtex/view.vim b/autoload/vimtex/view.vim index 3129969..cecd50c 100644 --- a/autoload/vimtex/view.vim +++ b/autoload/vimtex/view.vim @@ -131,9 +131,18 @@ endfunction " }}}2 function! s:general.latexmk_append_argument() dict " {{{2 + let opts = g:vimtex_view_general_options_latexmk + let opts = substitute(opts, '@line', line('.'), 'g') return vimtex#latexmk#add_option('pdf_previewer', \ g:vimtex_view_general_viewer . ' ' - \ . g:vimtex_view_general_options_latexmk) + \ . opts) +endfunction + +" }}}2 +function! s:general.latexmk_callback() dict " {{{2 + if exists("g:vimtex_view_general_callback") + exec "call " . g:vimtex_view_general_callback . "(b:vimtex.out())" + endif endfunction " }}}2 diff --git a/doc/vimtex.txt b/doc/vimtex.txt index 911b088..159af2d 100644 --- a/doc/vimtex.txt +++ b/doc/vimtex.txt @@ -860,10 +860,18 @@ Options~ Default value: '@pdf' +*g:vimtex_view_general_callback* + Sets the function that is called within |vimtex#latexmk#callback| after compilation + has finished. The function should take one argument, the pdf filename. It + will be empty if it could not be compiled. + + Default value: '' + *g:vimtex_view_general_options_latexmk* Set options that are passed on to `latexmk` for the specified general viewer, see |vimtex_viewer_general|. This allows to send options that - ensures a unique viewer, e.g. with |vimtex_viewer_qpdfview|. + ensures a unique viewer, e.g. with |vimtex_viewer_qpdfview|. Only the + `@line` escape is expanded. Default value: ''