I use Nvim to write my LateX documents. In my init.vim file I have defined a command to compile my .tex file like this:
command CompileXelatex !xelatex -halt-on-error %
I tried to do the same to view the pdf generated by XeLaTeX,so i created:
command ViewPdf !okular %:r.pdf
but this doesn't let me continue to work in my tex file, then I tried:
command ViewPdf !okular %:r.pdf &
command ViewPdf !okular %:r.pdf & disown
and none of these options worked like I want. The last two didn't open okular and the first one locks the terminal until I close the pdf viewer, which is not what I'm looking for .
I want to be able to open the pdf document on okular (or mupdf) and type in my tex file. I do not need it to live update (although if it's possible, I certainly would like), just to open the pdfviewer and let me work on the source in Nvim.
And I don't want to install any plugin to do it because I think is not needed just to open a pdf file.
Can you guys help me create this command?
(Ps. I do not speak english as my first language, so I'm sorry in advance for typos and strange wording)