When using NERDTree plugin the default behavior is to open a new file and keeping the NERDTree buffer open. What I want to do is to keep this default behavior but also overriding it when I want so the NERDTree buffer will be closed after I opened a file.
I know I can use
let NERDTreeQuitOnOpen=1 to automatically close the NERDTree buffer when I open a new file but this option totally overrides the default behavior (which is not what I want).
Ideally I would like to know if there is a built-in feature in NERDTree to do what I want. (I've been searching but didn't find anything like that so I suppose it doesn't exists actually)
And if that doesn't exists I had two ideas:
First one is to create a function which would set
1, open the file and then set again
Second one is to create the following mapping:
map d<CR> <CR> :NERDTree <CR> :bd<CR>which opens the file (first
<CR>), goes back to NERDTree buffer (
:NERDTree <CR>) and close this buffer (
:bd <CR>). I should improve it so the mapping only exists in the NERDTree buffer but I feel that's a pretty ugly solution and I thik it can be improved.
Which idea would be the best and why? Or is there an even better option?