0

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 &

and

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)

2
  • Nope. it does not. I tried the way you've wrote and vim says jobstart is not a editor command. I tried the call command (i'm a noob, i'm sorry iif what i'm saying is nonsense ) with jobstart and it's says that :r ins not defined and that i used invalid arguments for jobstart (obviouslly since I pushed a undefined paramater) – LATEX NOOB JP Oct 19 '20 at 4:55
  • 1
    Welcome to Vi and Vim! – D. Ben Knoble Oct 19 '20 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.