I recently switched from Latex-Box and I prefer single-shot compilation since I am sometimes working on large Beamer presentations with very long compile times. However, not having callbacks is inconvenient. Here's my workaround, which seems to have the behavior I want:
" .vimrc
let g:vimtex_latexmk_continuous = 1
let g:vimtex_latexmk_callback_hooks = ['SingleShotWithCallback']
function! SingleShotWithCallback(status)
silent call vimtex#latexmk#stop()
endfunction
Is there a reason this couldn't be built into vimtex by e.g. always setting -pvc and calling vimtex#latexmk#stop() after compilation when single-shot behavior is desired?
Interesting. I never thought of this, and it actually looks like a very good idea. I'll look into it later when I get more time.
Note, though: This relies heavily on the vim clientserver, and so I should probably keep the current implementation just in case, but I could add this as an alternative in cases where it should work.
I've added this now. If possible, it uses your suggested method, and if not, it reverts to the old method.
This is great! It should be changed in the documentation too: https://github.com/lervag/vimtex/blob/78e062c20163cc5700cff40f27175e789de38982/doc/vimtex.txt#L664
Edit:
This also seems wrong, I have single-shot compilations right now and the quickfix window is still opened:
https://github.com/lervag/vimtex/blob/78e062c20163cc5700cff40f27175e789de38982/doc/vimtex.txt#L1344-L1345
Edit:
And this:
https://github.com/lervag/vimtex/blob/78e062c20163cc5700cff40f27175e789de38982/doc/vimtex.txt#L1539-L1541
Thanks. I tried to improve this now.
Thank you. 馃槃
Most helpful comment
I've added this now. If possible, it uses your suggested method, and if not, it reverts to the old method.