I have a BufWritePost
autocmd that I want to run every time when a buffer is written but not when Vim is about to exit.
The variable v:dying
does not really help as it only indicates if Vim exists due to a signal but I also want to detect normal shutdown. So I am looking for some thing along the lines of
au BufWritePost * if ! s:do_we_quit() | Neomake | endif
but as of now I have no idea how to write the s:do_we_quit()
test.
Context:
The autocmd just calls :Neomake
to run syntax checks and linters on my files and load them into the quickfix/location list. But that does obviously only make sense on :w
and not on :wq
. Normally Neomake
works asynchronously but on exit it seems to me that vim hangs and waits for Neomake
and then somehow it ends up in an infinite loop.