3

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?

Ruslan
  • 475
  • 2
  • 12

1 Answers1

3

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 #
mMontu
  • 6,630
  • 21
  • 31