Vimtex: [Feature] Add option to automatically start continuous compiling

Created on 30 Sep 2015  路  7Comments  路  Source: lervag/vimtex

Basically I'd like an option that will start continuous compiling after the first time I do lv.

Most helpful comment

For those who might be viewing this now, VimtexInitPost was renamed to VimtexEventInitPost so the snippet from @lervag above should now be

augroup vimtex_config
  autocmd User VimtexEventInitPost VimtexCompile
augroup END

All 7 comments

I disagree. <leader>lv is used to control the viewer, not to start or stop compilation. You start compiling with <leader>ll.

Is there a way to start continuous compiling without opening the viewer? I would like to add an autocmd so that I always get the latest build when I do lv. If we have that, remapping lv to always enable continuous compiling would also be an option.

I've just pushed an update that adds a VimtexInitPost event. This can be used as follows:

augroup vimtex_config
  autocmd User VimtexInitPost VimtexCompile
augroup END

Which will automatically start to compile the document after a buffer has been loaded.

@lbischof I don't think there is a way to start continuous compiling without opening the viewer. You could try to search the latexmk manual/docs, see here. If you find a way to do it, then I could try to add this as an option.

@svenstaro Could you elaborate on what you really want? You want lv to first check if the document is compiling, and if it does not, then it should start compiling, and then open the viewer? Since latexmk automatically opens the viewer, I think we want something like this:

nnoremap <buffer><expr> <leader>lv
  \ b:vimtex.pid > 0 ? b:vimtex.viewer.view() : vimtex#latexmk#compile()

Note, the above won't work, since it is more like pseudocode. I think I want to/need to update the default mappings to only map if the target keys are not already mapped. If I did that, then you could add a mapping similar to the above mapping in order to get the desired behaviour.

Frankly I resorted to just using ll and haven't really looked back. For all I wanted, this issue can be closed as I just got used to your suggestion instead. I still don't think it makes a whole lot of sense to open and empty viewer (using just lv without ll) but you seem to have given that more thought than I have.

@svenstaro I actually use that quite often; when I look at old projects where the pdf is up to date, then I only want to view the source and the pdf file, and so lv is the only thing I need. In any case, I am happy if you are happy!

For those who might be viewing this now, VimtexInitPost was renamed to VimtexEventInitPost so the snippet from @lervag above should now be

augroup vimtex_config
  autocmd User VimtexEventInitPost VimtexCompile
augroup END

Yes, this is true. Thanks.

Was this page helpful?
0 / 5 - 0 ratings