Opening nvim-tree has a lag delay (1~2s) when root_dir of nvim-tree is different with current buffer
Description
If root_dir of nvim-tree is different with pwd of current buffer, it takes too long time (1~2s) to open nvim-tree. but these are same, the lag does not exist.
so I have to modify configurations to prevent this situration
- respect_buf_cwd = true
- actions.change_dir.global = true
is this bug situation?
p.s. How to set pwd changed automatically by current buffer location with nvim-tree?
when I use below code in init.lua
autocmd BufEnter * silent! lcd %:p:h
it works but it makes nvim-tree opening time very slow. I think the BufEnter event take the situation that nvim-tree open Could I change the pwd automatically by current buffer location?
Neovim version
NVIM : v0.9.4
Build type : RelWithDebInfo
LuaJIT : 2.1.1696883897
OS : Windows 10
Operating system and version
Windows 10
Windows variant
nvim-qt
nvim-tree version
96a783f
Clean room replication
default
Steps to reproduce
- open nvim-qt (New file)
- :NvimTreeFindFileToggle (C:\Users\USER, this folder has many files )
- open any file (c:\Users\USER.config\nvim\lua\lazy.lua)
- change pwd to current dir of buffer (c:\Users\USER -> c:\Users\USER.config\nvim\lua)
- :NvimTreeFindFileToggle (C:\Users\USER) // close nvim-tree maintaining root dir
- :NvimTreeFindFileToggle (C:\Users\USER) // open nivm-tree
Expected behavior
I think it has to take the same time to open nvim-tree
Actual behavior
In step 6, it will takes longer time (1~2s) than the situation which has the same directory between root dir of nvim-tree and pwd of current buffer. If pwd of current buffer is C:\Users\USER, then it takes short time to open nvim-tree
Please note that the nvim-tree team has no experience with nor access to windows. There are many known issues with file enumeration on windows.
From previous issues it appears that the C:\Users\USER contains many files that are not enumerable or take seconds to stat.
Please:
- repeat the test, starting in a directory that contains regular files only
- retry the test with WSL
- use the console version of neovim rather than nvim-qt