3

I launch vim with two files. I can move from one file to the other by :bp or :bn quite happily. But as soon as I make a change to file1 it won't allow me to move to the other buffer unless I save the changes! I should be able to move between buffers and edit them without having to save (unless I want to close the buffer).

I get the message:

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

this is the version I am using (with Ubuntu 20.04):

VIM - Vi IMproved 8.1 (2018 May 18, compiled Sep 20 2021 11:42:42)

1 Answer 1

3

Add set hidden to your vimrc.

Although :h 'hidden' doesn't state it clearly, it would allow you to switch buffers without saving them.

1
  • Thanks Maxim it worked. In my previous laptop/installation I didn't have this problem. I wonder if set hidden was in the .vimrc by default and has now been removed.
    – user25109
    Oct 24, 2021 at 16:14

Your Answer

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