My bad, I actually was able to reproduce this; just didn’t realize.
Looks like using <C-^> switches to which buffer you’re on depending on the file which was last opened, edited, or, deleted in your case (for a bit more information read :h CTRL-6. I’m pretty sure this is a feature rather than a bug
Thanks a lot for investigating! I didn’t know how to find the help file for this command, this helped me a lot. I suspected that this was a feature rather than a bug, but I was wondering if there’s a way around it.
Maybe I should clarify a common use case I have for it: Often I edit one file a, then I use :E to open NerdTree and search for another file b and open it. Then I want to go back and forth several times between a and b. When I hit <C-^> to do this, I get the NerdTree buffer, which is now completely empty. So that doesn’t help. But even if I delete the NerdTree buffer with :bd, it doesn’t help because now I’m back in file b and if I do <C-^> again, it re-opens the closed NerdTree buffer.
I have in the meantime found that other people had similar problems:
Ah yeah, I could imagine myself running across that. If you haven’t found a solution yet, maybe you can just use :bn and :bp (map it to some keybinding) for the meantime? I know it doesn’t really toggle through the file which was last opened, but it might suffice according to your use case of there being 2 files.
Thanks. Your suggestion of using :bn and :bp made me search a bit more and I found an interesting command I didn’t know yet: :bwipeout. It not only removes a buffer, but it removes everything associated with it, including its position in the jumplist etc. Using this I, can easily remove the netrw buffer for good.