I am using NERDTree to open files. If I am on a file path in vim and I hit
gf this works fine for files. For folders,
gf opens a new NERDTree buffer in this folder which is fine. I can then choose a file.
I am having a hard time to make this NERDTree buffer disappear again: Hitting
:bd as suggested here does not do anything.
Recently, I found out the following:
:buffers I can find the number of the buffer that I want to delete. Suppose the NERDTree buffer is 5, I can do then
:5bd, and the NERDTree buffer is gone.
This works fine. However, when I try to make it easier by getting the number of the current buffer, from
:execute bufnr("%") "bd" <CR>, it does not work.
In that context, I saw that the numbers from
:echo bufnr("%") are different for these NERDTree buffers.
Did anyone ever encounter this and/or has a solution?
Cheers and many thanks,