-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error detected while processing BufEnter Autocommands for "*" with the "Close the tab if NERDTree is the only window remaining in it." config #1411
Comments
Hi, I've tried to reproduce the issue on my machine with no result. In case there are any more details in the error message you are receiving please send them here. Try using the |
Thank you for your answer. I thought I was using latest NERDTree version. Perhaps an issue with scroolose vs. preservim. Anyway I updated to latest NERDTree and I'm still facing this issue. I'm using vi from Debian repo. I shall try to see if I can install from testing or any other repo without screwing up my system. I can also try neovim 0.7.2 but that's pretty old. Here's what I get from the
Searching with that latest line, I found @mb6ockatf's #1354. Same issue, closed just after opening. |
Ok, I found the issue, It took a bit of digging but it seems like Vim9 from this patch onward won't allow changing the layout which is a breaking change. Since this snippet was from a FAQ section most people probably didn't use it and that's why it went unnoticed for more than 2 years. Neovim being backward compatible also didn't help it. The one time that it came up the author of the issue closed it which is most probably because they found out about this change and used a new workaround for their case. According to this mailing list thread you can use " Close the tab if NERDTree is the only window remaining in it.
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | call feedkeys(":quit\<CR>:\<BS>") | endif |
Works a treat! Thank you so much! This was frustrating and I'm totally illiterate when it comes to Vim scripts. Indeed, that ML thread was referred to in the issue I linked to in OP. Thanks again for sorting this out. (Still wondering how people live without this config line. Not saying it should be default. Just surprised the issue didn't come up earlier.) |
That's great to hear! |
OK, I'll be using this on a daily basis from now on and I'll be sure to report back if anything happens (which I'm sure won't happen). |
Solve weird occasional error message. See also: preservim/nerdtree#1411
I can confirm that this bug exists using the current version of both NERDTree and Vim and that the suggested fix works. I believe it is time that someone with write access updates the README.md file by replacing the defunct command with the fixed one or at least adding the fixed one while making it clear the fix is necessary for Vim 9. |
Yes, you are totally right, I didn't intend this change to take so long. In the last few months, I was too caught up in a deadline and I forgot about changing this. In retrospect closing this issue as you've mentioned wasn't the brightest idea of mine - although I meant good - Leave it to me. I'll update the FAQ section tonight. |
@hippie68 Other than Right now I mostly use neovim so some of these issues might go unnoticed for me. |
Environment
:version
: VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 04 2023 10:24:44)?
: 7.0.1 (9ec27d4)Nope, I removed all plugins.
Steps to Reproduce the Issue
Open a file, open NERDTree, open another file, open NERDTree, close a file.
Current Behavior (Include screenshots where appropriate.)
I get this error message
and NERDTree is still open.
Expected Result
Tab closes.
This reminds me of jistr/vim-nerdtree-tabs#102.
I'm trying to get rid of vim-nerdtree-tabs because it is unmaintained and because I realized what I'm using it for should be achievable using the sample config lines from NERDTree README.
I'm surprised I'm getting that same error.
I removed all plugins and kept that single line in the config file, which makes me wonder how come no one else is affected. I don't see anything specific in my setup.
The text was updated successfully, but these errors were encountered: