How do I make BufWritePre work with: wa?

I have a hook BufWritePre

that unfortunately doesn't work with :wa

, only with :w

(and also with :wq

).

How can I get it to work with :wa

?

This is the hook I have in mine .vimrc

:autocmd BufWritePre *.c* :ClangFormat

+3


source to share


1 answer


BufWritePre

run only when the buffers are actually written. :w

is forced to write, but :wall

not, it only writes the buffers that have changed. If you want to force all buffers to be written (modified or not), you can do something like :bufdo w

. It will also launch BufWritePre

friends.



+3


source







All Articles