I have multiple buffers open, some currently visible, some not. I know I can write all of them with :wa. However, I am curious, why :bufdo w does not work. When I try it in a buffer with unsaved changes, vim tells me

E37: No write since last change (add ! to override)

Why is this so?

  • 3
    I don't reproduce your error, can you try with set hidden ?
    – nobe4
    Aug 6, 2015 at 13:10
  • With hidden enabled it works.
    – oarfish
    Aug 6, 2015 at 13:12
  • My guess is, your current buffer is modified. And when doing :bufdo, Vim first tries to go to the first buffer, which isn't allowed, unless you set hidden or write the current buffer first. Aug 6, 2015 at 20:52

1 Answer 1


I'm feeling like you don't have the option hidden set.

Basically, it means that you cannot switch from an unwritten buffer to another one.

In your case you cannot save any buffer because it should change from an unwritten buffer. Adding the hidden option will fix this.

You can find more with : :h hidden.

  • I find it strange though. Since the operation I want to run is writing the buffer, I would expect that vim attempts to do that first, before switching to the next buffer.
    – oarfish
    Aug 6, 2015 at 13:16
  • You should really look at :h hidden ;) I quote "The commands that move through the buffer list sometimes make a buffer hidden although the 'hidden' option is off ..."
    – nobe4
    Aug 6, 2015 at 13:17
  • I read it, but I don't understand how it relates.
    – oarfish
    Aug 6, 2015 at 13:54
  • 3
    I think that when you enter :bufdo w, vim first switchs to the first buffer to write it, then, go to the second one and write it, and so on.. So your current buffer becomes hidden, which is forbidden without setting the hidden option.
    – nobe4
    Aug 6, 2015 at 13:57
  • Okay, that sounds reasonable. Not sure if I'm the only one, but I rarely find it trivial to understand vim's documentation when it comes to non-obvious features.
    – oarfish
    Aug 6, 2015 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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