I'm writing a script to ensure that everything I work on on my system is committed, pushed to Git etc. I'd also like to check if there are any vim swapfiles active (either in a running Vim, or from abnormal exit).
How can I check? Short of starting a vim for each tracked file and somehow checking if vim complains about recovery / swap active.
Even nicer would be to check from the outside if there are modified buffers in any running vim instance, but that doesn't seem too feasible
NOTE I'm keeping all my swapfiles in a separate dir (:set directory=
), so it's hard to associate swaps with reals (probably requires parsing viminfo
)
:h 'directory'
to something like~/.vim/swap/
and then checking for the existence of files in this directory (ls
,find
, or whatever you are comfortable with)?noswapfiles
and I was sure that vim deletes the swapfile when it's done with a buffer.