I used to use LaTeX-Box plugin to compile and view LaTeX documents with these mappings.
But I don't use it anymore because \begin
and \end
highlighting (and to a lower degree parentheses matching), which can't be turned off, make Vim a lot slower in big .tex
files.
I know how to create an alternative mappings for compiling .tex
documents:
autocmd FileType tex nnoremap <buffer> <F2> :!latexmk -xelatex %<cr>
autocmd FileType tex inoremap <buffer> <F2> <Esc>:!latexmk -xelatex %<cr>a
But this will create output files in directory I am currently in, not in the directory where .tex
file is (for example, if I am in ~/Desktop
and I open in Vim a file which is in ~/Documents
, if I press F2
, .pdf
and all other files are created in ~/Desktop
instead of in ~/Documents
).
I don't know how to create mappings for viewing the compiled .pdf
document.
So, I am asking you to help me create mappings that will compile .tex
file, and view created .pdf
file.