2

I've noticed that when I have several files open in Vim, and one of the files has been changed by an external program, :wa doesn't actually try to write into that file. OTOH, going to that file and explicitly saying :w does try to actually write (I get asked whether I want to overwrite the changes).

I'd like :wa to behave like "for all files, do :w", so that I got asked whether I want to overwrite all the externally-changed files.

How can I achieve this?

2

Instead of :wa you could try using :bufdow, which will issue :w for each buffer in the buffer list.


Edit:

Notice that the bufdo will change the buffer on the current window. The following command correct this and may also be easier to remember:

command! -nargs=0 Wa :bufdo w <bar> :edit #

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.