2

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.

1
  • Do you still have the problem. Have you found how to solved the problem or considered accepting an answer that solves your problem (if any)? Dec 5, 2011 at 18:56

1 Answer 1

3

Ok, I was just being an idiot. I didn't want set bufhidden=hide in my vimrc - that's just for a single buffer. Now that I've changed it to set hidden everything works as I felt it should.

1
  • Could you add this as your accepted answer, since it worked for you?
    – jrg
    Jun 7, 2011 at 16:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .