I have two functions
tex#PDFClose() to automatically open and close the pdf file created by a TeX document.
The way I assign them to autocommands is via the following autogroup in
augroup TeXGroup autocmd BufEnter <buffer> call tex#PDFOpen() autocmd BufUnload <buffer> call tex#PDFClose() augroup END
Now if I open a .tex file
tex#PDFOpen() is called, but if edit another buffer with
:e ..., then
tex#PDFClose() is called, which I don’t want. If I switch back to the buffer with the .tex file,
tex#PDFOpen() is called again, which I also don’t want.
tex#PDFOpen() should only be called
- on startup, if the argument of
nvimis a .tex file;
- when editing a .tex file in a new buffer.
tex#PDFClose() should only be called
- on exit, if one of the buffers contains a .tex file;
- when closing a buffer with a .tex file with
I’ve tried every event listed here, but none of them have worked.