Maybe my title is not so clear; I Googled a lot about cleaning up temporary files after a PDF is generated, and find it is not recommand to remove it completely in each compile.

I do want to remove it in the final with one-or-two key press in Vim.

So my question is: Can we add some code to _vimrc such that I can define which kind of file shall be removed after the compile? (I mean success compile, auto-remove, at least when I ask to remove it by press key short.)

I hope it will work both on Windows and Unix systems. (Maybe needing different code.)

  • 1
    You can do it easily with arara. – user11232 Jan 22 '14 at 3:51
  • If you are using a build system (see this question ), most of them have a command to clean the temporary files. Mapping this to a vim shortcut shouldn't be too difficult. – Psirus Jan 22 '14 at 7:36
  • In fact, I use miktex on windows system with vim as the text editor, how to do it? – user19832 Jan 22 '14 at 9:17

you could use

:!del *.aux *.log *.out *.bbl *.blg ...

in vim and map this to a key you like (F11 for instance) in your vimrc file.


I'm using a powershell script under windows to this end, I found it years ago here: http://uweziegenhagen.de/?p=2095

The first sentences on this page in German simply says something like »... after I found out how to make powershell work on a certain path, we can easily write a script which deletes all temporary files in a certain folder«. So take this script, save it as "cleaning.ps1" or something alike and start it as powershell script.

It doesn't work under Linux, of course. And you'll have to find out, how to start a powershell script from vim. Good luck!

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.