Hi,
It would be nice if the plugin could run :VimtexClean (or :VimtexClean!) automatically when closing the tex file.
Thanks,
Nico.
I found this to be harder than I first thought. I will look into it later, in the mean time I hope you can live without the feature.
Sure! I can do the cleaning myself in the mean time.
Maybe I'm overlooking something, but for me
augroup vimtex_config
autocmd!
autocmd Filetype tex autocmd BufUnload <buffer> VimtexClean
augroup END
Works pretty well.
@Eisfreak7 It works well if you are working on single file projects. If you are working on a multi-file project with several buffers open, this does not work that well, since it will call VimtexClean when you close one of the buffers of the project. But perhaps it works for @nsirolli?
I plan to add some user events or hooks that will allow custom commands to be run before exiting a vimtex project, for instance. However, it needs some refactoring and updates to much of the code, and so I have not had the time to do it yet.
It works for me, thank you @Eisfreak7!
I've pushed an update that adds a VimtexQuit event. This event is triggered when the last file of a LaTeX project is closed. Note, though, that in this scope, the commands are not available. The functions are, though, so the following will work as you want:
augroup vimtex_config
autocmd!
autocmd User VimtexQuit call vimtex#latexmk#clean(0)
augroup END
I'm afraid this update is not working for me. This is the setting here.
OS: Debian 8.2
Vim version: 7.4.576
Vim settings:
let g:tex_flavor = 'latex'
let g:vimtex_fold_enabled = '0'
let g:vimtex_fold_automatic = '0'
let g:vimtex_view_general_viewer = 'okular'
let g:vimtex_view_general_options = '--unique @pdf\#src:@line@tex'
let g:vimtex_view_general_options_latexmk = '--unique'
augroup vimtex_config
autocmd!
autocmd User VimtexQuit call vimtex#latexmk#clean(0)
augroup END
Steps performed:
Expected result: auxilary latex compilation files get removed
Actual result: auxilary latex compilation files do not get removed
Hi. I've made some minor tweaks. Could you please try again, now with
augroup vimtex_config
autocmd!
autocmd User VimtexEventQuit call vimtex#latexmk#clean(0)
augroup END
Ah, I see. I did not really quit my Vim session, I only closed the buffer. I think it should work with the commit I'm pushing now.
It works now :)
Great, glad to hear it!
lør. 7. nov. 2015, 23.47 skrev Nicolás Sirolli [email protected]:
It works now :)
—
Reply to this email directly or view it on GitHub
https://github.com/lervag/vimtex/issues/253#issuecomment-154760884.
This fix doesn't work for me, does it still work after using VimtexStop
@Carslake22 the function name changed:
augroup vimtex_config
au!
au User VimtexEventQuit call vimtex#compiler#clean(0)
augroup END
awesome thanks
Most helpful comment
@Carslake22 the function name changed: