nvim-tree / nvim-tree.lua

A file explorer tree for neovim written in lua
Other
7.2k stars 609 forks source link

Opening nvim-tree has a lag delay (1~2s) when root_dir of nvim-tree is different with current buffer #2612

Closed Jaehaks closed 2 months ago

Jaehaks commented 10 months ago

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

  1. respect_buf_cwd = true
  2. 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

  1. open nvim-qt (New file)
  2. :NvimTreeFindFileToggle (C:\Users\USER, this folder has many files )
  3. open any file (c:\Users\USER.config\nvim\lua\lazy.lua)
  4. change pwd to current dir of buffer (c:\Users\USER -> c:\Users\USER.config\nvim\lua)
  5. :NvimTreeFindFileToggle (C:\Users\USER) // close nvim-tree maintaining root dir
  6. :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

alex-courtis commented 10 months ago

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:

jinzhongjia commented 2 months ago

The problem seems to no longer exist, I tested it on my newly installed win11 system and there was no delay.