Skip to content
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

NvimTree closes nvim when opening a folder #2

Open
antenore opened this issue Jun 28, 2022 · 4 comments
Open

NvimTree closes nvim when opening a folder #2

antenore opened this issue Jun 28, 2022 · 4 comments

Comments

@antenore
Copy link

First of all thanks a lot for this repository, it's a really nice source of inspiration.

This auto command causes neovim to close when I try to open a folder (:e /path/to/folder)

vim.api.nvim_create_autocmd({ "BufEnter" }, {

Does it happen to you as well?

I didn't find a solution yet, except commenting that block.

For reference, with NerdTree it works correctly, but the command is a bit different

'if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif'
@ttys3
Copy link
Owner

ttys3 commented Jun 28, 2022

thank you for reporting this issue.

I tried and confirmed this can be re-produced

there seems no perfect implementation at this time, see:

nvim-tree/nvim-tree.lua#1115

nvim-tree/nvim-tree.lua#1368

nvim-tree/nvim-tree.lua#1005

I think we'd better disable this feature or make it configuable

@antenore
Copy link
Author

Interesting, what's weird is that NERDTree works without a glitch (AFAIK).

I'll try to investigate this further when I'll some time.

Thanks for your support!!!

@antenore
Copy link
Author

Moreover, in NERDTree primary has been renamed to tab, therefore that if in the auto-command never evaluate to TRUE.

Hence, it's false that it works.

@antenore
Copy link
Author

Sorry for the noise, this is the last one.

This the right way to do it in NERDTree

autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants