Issue:
While NERDTree is open, if there is more than one open tab and you close a tab (:q) the following error
is reported:
Error detected while processing WinEnter Autocommands for "*"..function <SNR>147_WinEnterHandler
[10]..<SNR>147_CloseIfOnlyNerdTreeLeft:
After acknowledging the error, the buffer in the tab is replaced by a full width NERDTree and NERDTree becomes about 80% width in all other open tabs.
If there is only one tab open then :q closes that tab and vim quits.
This seems to be caused by the function CloseIfOnlyNerdTreeLeft in nerdtree_plugin/vim-nerdtree-tabs.vim
specifically:
if exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) != -1 && winnr("$") == 1
Similarly:
In the NERDTree issue preservim/nerdtree#21 there is a discussion around a similar
problem and it is noted that t:NERDTreeBufName no longer exists.
I tried replacing the if statement with a few suggestions from that issue, to no avail. I tried:
if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary")
and
if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree())
I understand that this project is no longer actively maintained, however I wanted to report the issue in case others are seeing similar problems.
Versions:
Error occurs:
vim 9.0.1200 on macOS 11.7.2 (Big Sur)
vim 9.0.1151 on macOS 13.1 (Ventura)
Error does not occur:
vim 9.0.920 on macOS 11.7.2 (Big Sur)
vim 8.0.3741 on ubuntu 18.04.6 LTS (Bionic Beaver)