I want to autorun formatter when saving a file. Using BufWritePre doesn't work when quitting with :x (or ZZ), if the file hasn't yet been modified. ExitPre or QuitPre don't work either.
Is there an autocmd-event that works on unmodified buffer with :x, but not :q
94 views Asked by Kljunas2 At
1
It's beacuse
:xnorZZsaves buffer when it's not modified. From documentation:If you would like to have it working on
:x/ZZyou can map it to:wqwhich always saves buffer or useBufWinLeave