Can you please suggest any latex plugin with livereload/preview support ? All of the plugins google suggested me does not support preview/reload, or use 3rd party tools that use another 3rd party tools and so on... Which one do you use or can suggest (if you sure it really work on linux).

Thank you !

  • Have you tried vimtex? I am not sure I quite understand what you mean by "livereload". vimtex supports previewing with different viewers and uses latexmk as a backend for continuous compilation. It works well on Linux. Commented Oct 11, 2016 at 21:04
  • 2
    I don't understand your question. The most common output of LaTeX nowadays is a pdf file, that must be viewed in a pdf viewer, and any decent pdf viewer will automatically refresh when the file displayed changes. If you mean "auto-compile every so often", I don't think this a good "feature" at all, as an "auto-compilation" might happen at a point when the LaTeX source is "broken".
    – Dalker
    Commented Oct 12, 2016 at 4:38
  • Currenty , i use pdflatex for compiling my .tex files into .pdf and then open it with zathura pdf viewer. I would see my documents after i change something without running additional commands manually or even waste time to save changes inside the editor. How do you resolve it ? It seems like i can map some keys for building. I thought there is complete solution for case like mine. Commented Oct 12, 2016 at 9:20
  • If you don't save the file, all the changes are just on the vim buffer. What would it trigger on? CursorMoveI? You might wanna put a shebang at the top to tell the shell to open the file in pdflatex and then map something to :w<cr>:!%:p<cr> or something similar
    – Wolfie
    Commented Oct 12, 2016 at 14:14
  • 1
    Most people are content to save the file, and use latexmk with continuous compilation mode on; the pdf viewer will auto-refresh the pdf at every save, thus acting like a nice and easy preview method. Use git commits instead of using save as an "important work was done" operation.
    – VanLaser
    Commented Oct 12, 2016 at 21:03

1 Answer 1


I've created the function that compile tex files, and can be mapped to any key binding. As @Dalker said pdf viewer will automatically refresh when the file displayed changes , and it really do. Am not exactly sure about git related stuff @VanLaser said.. i think he meant that i have save the file changes first.. maybe not.. idk

function! MKTex()
  if (&ft == 'tex')
    let s:dir = expand('%:p:h')
    let s:file = expand('%:p')

    execute '!pdflatex -interaction=nonstopmode -output-directory ' . s:dir .' '. s:file
    echo "For .tex files only."
  • Just to add 2 points: 1) in the comments @ VanLaser was suggesting to automatically rebuilt your pdf each time you save your Vim buffer and to use an external tool (git) to save the important versions of your document. It could be useful to save the different steps of your work but this is not absolutely necessary in you case.
    – statox
    Commented Oct 17, 2016 at 10:53
  • 2) Now about your function: you could replace your whole function by this line: autocmd FileType tex command! -buffer MKTex execute '!pdflatex -interaction=nonstopmode -output-directory ' . expand('%:p:h') . ' ' . expand('%:p') this way every time a buffer see its filetype set to tex the command MKTex will be defined only in this buffer its shorter and you don't have to check the filetype yourself. You can see :h :autocmd and :h autocmd-events
    – statox
    Commented Oct 17, 2016 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.