I've recently switched from Emacs to Vim, so this may just be me completely misunderstanding how Vim works.
I've opened a file in Vim and make some changes but don't save them. I then use :e otherfile
to open a second file, and make some changes to that. Again, without saving the changes, I'd like to go back to the first buffer. I'm using :bn
for that, but when I do I get E37: No write since last change ...
. If I do :bn!
then I can change back to the first buffer. From the first buffer I can change back to the second buffer with a straight :bn
, but I have to do :bn!
to go from the second buffer to the first every time.
I've got set bufhidden=hide
in my vimrc, but if I run :set bufhidden?
in Vim I get bufhidden=
. Is that the problem maybe?
Edit: I've narrowed the problem down a bit. In the first file, :set bufhidden?
returns bufhidden=hide
, but in the second file, it returns bufhidden=
. What's up with that? Am I missing something fundamental about Vim buffers here?
Edit2: Ok, it seems like set bufhidden=hide
only applies to the first buffer opened. It needs to be explicitly called in subsequent buffers. I must be completely missing the point here, because this doesn't seem useful.