Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
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)? –  Luis Alvarado Dec 5 '11 at 18:56
add comment

1 Answer 1

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.

share|improve this answer
    
Could you add this as your accepted answer, since it worked for you? –  jrg Jun 7 '11 at 16:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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