I use vim pretty extensively for latex compiling. I've a function which automatically compiles the current tex file. I use
pdflatex as a compiler, which creates a bunch of different files that it needs to compile the tex file nicely. But these extra files are just visual clutter for me so I've created a shell script that cd-s into the directory and removes the extra tex dependencies.
I've put this line of code in my vimrc to automatically execute that script.
autocmd BufLeave *.tex ! <path-to-the-shell-script>
My problem is this script runs as many times as I compile the tex file, while it does the trick just fine in only one execution. Note that, there is no problem with the shell script, if I run it from the terminal it works perfectly fine but when running it with the above autocmd it seems to run multiple times (as many times I compile the tex file).
I've also tried
BufWinLeave, the problem still persists. I've changed the autocmd to run silently, but I was wondering if there's a way to fix this all together?
autocmd BufLeave *.tex silent ! <path-to-the-shell-script>
:autocmdshow? Possibly you have it installed multiple times