I have two windows that I created with a :vsplit. Window 1 displays a file with changes that have not been saved yet, Window 2 displays another file.

I want to get rid of Window 1, so I type :only in Window 2. However, vim complains that E445: Other window contains changes and refuses to proceed.

I appreciate that it tells me this but I don't understand why it doesn't proceed. I'm not leaving, why should it care?

  • Notice that Vim's session also stores slient only on line 4, which might introduce this error. Commented Feb 14, 2023 at 3:09

2 Answers 2


Vim doesn't close the windows because you don't have either of the 'hidden' or 'autowrite' options set (which indicates to Vim that you don't want windows with unsaved changes to be easily closable).

:help :only (or :help E445) gives more details:

When the 'hidden' option is set, all buffers in closed windows become hidden.

When 'hidden' is not set, and the 'autowrite' option is set, modified buffers are written. Otherwise, windows that have buffers that are modified are not removed, unless the [!] is given, then they become hidden. But modified buffers are never abandoned, so changes cannot get lost.

See also :help hidden-buffers for more details of how Vim handles this.


Vim generally has a policy of not getting rid of windows with changes unless you force it with !.


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.