Last updated on October 1, 2016
Vim, as a highly configurable and customizable editor, already has a powerful Vim-LaTeX plugin. However, I don’t like the lack of live preview feature. For this reason, I developed a plugin called vim-latex-live-preview last year. Although it currently can’t handle complex situations such as multiple tex files, it could basically handle single tex file project well (with or without BibTeX, thanks to Asis Hallab).
Note: This plugin currently doesn’t work on Windows.
Before installing this plugin, please make sure that you have ++python feature in your Vim. Type
:version and if you see
+python in the output, then you have this feature enabled in your Vim. Then, you could either:
I would recommend using the second way, since pathogen can well organize your installed plugin, making plugin installation and uninstallation much easier.
First please set the vim option
updatetime to a smaller value, which is the frequency that the output PDF is updated. I would recommend setting it to
1. Basically you can simply add the following line to your
autocmd Filetype tex setl updatetime=1
Then visit this page to see a list of PDF viewers that could work with this plugin. If you want to use any pdf viewers that are not marked as “built-in”, you need to add the following line to your
let g:livepreview_previewer = 'my_pdf_viewer'
Now open up a tex file with Vim. Run
:LLPStartPreview to start previewing and enjoy!
If you frequently need to use the preview feature, I suggest you to map the preview command onto some key binding:
nmap <F12> :LLPStartPreview<cr>
A simple screenshot:
An alternative might be Kevin Klement’s vim-live-latex-preview, which I haven’t tried out though.