nvim-neo-tree / neo-tree.nvim

Neovim plugin to manage the file system and other tree like structures.
MIT License
3.7k stars 218 forks source link

Opening Neotree when vim is editing a directory gives error first time #1014

Open ashb opened 1 year ago

ashb commented 1 year ago

Hello,

I've noticed a weird glitch in Neotree when I launch vim with a directory argument that is not a subfolder of current directory, and try to reveal the current:

For example: cd ~/.local && nvim ~/.config' and the run the lua command:lua require('neo-tree.command').execute {reveal=True})` gives the following error:

Error executing vim.schedule lua callback: ...h/.local/share/nvim/lazy/nui.nvim/lua/nui/split/init.lua:183: Invalid window id: 1004
stack traceback:
        [C]: in function 'nvim_set_current_win'
        ...h/.local/share/nvim/lazy/nui.nvim/lua/nui/split/init.lua:183: in function '_open_window'
        ...h/.local/share/nvim/lazy/nui.nvim/lua/nui/split/init.lua:249: in function 'mount'
        ...are/nvim/lazy/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:966: in function 'create_window'
        ...are/nvim/lazy/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:1119: in function 'draw'
        ...are/nvim/lazy/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:1267: in function 'show_nodes'
        ...ree.nvim/lua/neo-tree/sources/filesystem/lib/fs_scan.lua:98: in function 'render_context'
        ...ree.nvim/lua/neo-tree/sources/filesystem/lib/fs_scan.lua:126: in function <...ree.nvim/lua/neo-tree/sources/filesystem/lib/fs_scan.lua:125>

This error only happens the very first time per neovim process that I try to launch it this way. Running Neotree reveal I notice a "flash" of the "not in the cwd, y/w" prompt, but it is quickly swallowed by the above error.

In case it is relevant, my home dir is a git folder, and I do have git integration enabled, and I'm using NvChad + lazy.nvim.

Oh, version 2.66.0

pysan3 commented 1 year ago

Could you share your config or a minimal config code to reproduce? I think NvChad's default config does not have neo-tree.

Are you using noice? which might be a cause.