I'm currently exploring ways to iterate through all buffers in vim and am confused by the behavior of NERDTree.

I displayed the NERDTree directory tree and expected that the viewport is bound to some buffer. But the :ls command did not show the buffer that is diplayed in the NERDTree's viewport:

enter image description here

Is the viewport on which NERDTree displays the directory tree bound to some buffer? If no, how does NERDTree display the content?

1 Answer 1


NERDTree does a great many things that are... unvim-like... in order to give the IDE “project drawer” experience. I consider most of them hacks, and I’m wary of a plugin which has to hack around default behaviors and usages to do something I don’t need (see Oil and Vinegar).

All of that said, one of its hacks is actually quite normal—it’s an unlisted buffer (I believe). You can check the 'buftype' option, or use :ls!.

Netrw actually does similar things most of the time, regarding unlisting buffers. It’s convenient not to have “non-file” buffers not appear in the regular buffer list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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