nvim-config icon indicating copy to clipboard operation
nvim-config copied to clipboard

NvimTree closes nvim when opening a folder

Open antenore opened this issue 3 years ago • 4 comments

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)

https://github.com/ttys3/nvim-config/blob/693e9e106189b6cd1399776b95997d33591e3ac8/lua/config/nvim-tree.lua#L67

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'

antenore avatar Jun 28 '22 09:06 antenore

thank you for reporting this issue.

I tried and confirmed this can be re-produced

there seems no perfect implementation at this time, see:

https://github.com/kyazdani42/nvim-tree.lua/discussions/1115

https://github.com/kyazdani42/nvim-tree.lua/issues/1368

https://github.com/kyazdani42/nvim-tree.lua/issues/1005

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

ttys3 avatar Jun 28 '22 10:06 ttys3

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 avatar Jun 28 '22 11:06 antenore

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 avatar Jun 28 '22 11:06 antenore

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

antenore avatar Jun 28 '22 11:06 antenore