7

I've been using vim for more than 5 years now, and I was surprised when I didn't know what an abandoned buffer was. The closest answer I found was in this SO answer.

So is an abandoned buffer one that was loaded but is not displayed any more? What about if there are multiple tabs - are any of the buffers loaded in these tabs abandoned or not?

7

An "abandoned" buffer is a buffer you left without saving changes.

If you have set nohidden (the default value), Vim generally warns you about unsaved changes when you try to leave a modified buffer. When you force your way with a bang, the previous buffer becomes "abandoned" and you loose all your unsaved changes.

If you have set hidden, modified buffers are kept in their current state when you leave them so they are — technically — never "abandoned". You will still get a warning if you try to quit Vim with unsaved changes.

As long as it's still displayed in a window, a buffer can't be thought of as "hidden" or "abandoned" so your buffers currently displayed in another window in another tab page are neither "hidden" nor "abandoned".

  • I might have discovered a bug in this case (or just weird behaviour): 1. edit a buffer, don't save; 2. set hidden; 3. switch to another buffer; 4. set nohidden; 5. go back to hidden buffer; 6. go back to non-hidden buffer: the result is that the hidden buffer is automatically saved. Is this working as expected? – stanm Aug 27 '15 at 10:46
  • @stamm, can't reproduce – Christian Brabandt Aug 27 '15 at 13:28
  • 1
    @stanm: can't reproduce either, after the 5. the first buffer is still changed but now I can't go back to the second buffer (because nohidden is set). What is your config ? – nobe4 Aug 27 '15 at 13:38
  • @Nobe4: okay, that's what I expected as behaviour. My config sources multiple external rc files (corp), so perhaps somewhere in there is the reason. Thanks for the help, though! – stanm Aug 27 '15 at 14:16
  • @stanm maybe autowrite gets involved? set autowrite? and set autowriteall?, what do they show? – Jason Hu Aug 27 '15 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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