Repository navigation
feat(#3394): experiment: async first git load, see :help nvim_tree.config.experimental, discuss at https://github.com/nvim-tree/nvim-tree.lua/issues/3397 - #3395
Conversation
…nc git load Closed directories explored while git status was in flight kept the children filtered against the empty status, and reopening them does not explore them again. Walk every explored directory instead of the open ones only. Document that git.timeout still applies and that reloads still block, and add line comments to the changed functions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved Git-refresh issues can leave hidden directories stale, overwrite grouped submodule statuses and filters, and allow older initial-scan results to replace newer updates.
3 open issues
What changed in this PR
Adds an opt-in asynchronous initial Git status load to reduce blocking when opening large repositories, addressing #3394 while keeping tree construction synchronous.
Changes:
- Adds
experimental.git_async_load, disabled by default. - Loads initial Git status in the background, then refreshes explored directories and restores cursor focus.
- Documents temporary filter behavior, timeout handling, and synchronous reloads.
| File | Description |
|---|---|
lua/nvim-tree/git/init.lua |
Implements asynchronous initial loading, completion refreshes, and shared watcher creation. |
lua/nvim-tree/config.lua |
Adds the disabled-by-default experimental option. |
lua/nvim-tree/_meta/config/experimental.lua |
Defines and documents the option and its limitations. |
doc/nvim-tree-lua.txt |
Updates help text and the default configuration example. |
Review effort: Balanced
|
The Copilot review on this PR was requested automatically by my GitHub settings. I did not intend it. |
There was a problem hiding this comment.
This is just fantastic, nice work!
Please:
- Create a new issue similar to #3343, which will be pinned
- Remove all code comments that should be PR inline comments e.g.
-- moved unchanged from load_project, so that the synchronous and asynchronous loads share itThey do not add any value for future maintainers, see similar #3388 (comment)
Next:
- Merge with
git_async_load = false - Change to
git_async_load = trueafter several weeks - Finish the experiment and remove old codepaths
Testing notes:
git_async_load = false, working as normal- project load: statuses appear after tiny delay, ignored are hidden in directories and root
- new git watcher working:
touch .git/configgit checkoutdirty and clean
- open an ignored file and
:NvimTreeFindFile- focuses root
- focues parent folder
Review notes, no action required
load_project_asynccallingreload_git_projectis equivalent to the functionality at the end of the sync path ofload_project- new
create_git_watcherfunction is shifted unchanged fromload_project reload_project_nodesis the new functionality required for the async update, which does the minimum required byExplorer:explore, although the draw and focus are required at the end. draw is done only once, resulting in the minimum of 2 draws on load.
Apologies, CONTRIBUTING was misleading and incorrect, updated: |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Many thanks @tomo-2525
Merged and released.
Pinned issue #3397 created, please watch this issue.
It's enable for me.

resolves #3394
Design
Opening a large repository of my notes was slow, so I wanted the git status to be loaded lazily.
experimental.git_async_load, off by default.Explorer:_loadis unchanged), and only the git status is loaded later. This keeps the change small and insidelua/nvim-tree/git/init.lua.git_ignoredfiles are shown andgit_cleanhides every file. I think a short time without git status is better than Nvim blocking.AI usage
AI used: Claude (Claude Opus 5.5) in Claude Code. The code was also reviewed by another Claude model (Claude Fable 5.2).
All code and documentation in this PR were written by Claude. None was written by me.
What I did:
git/init.lua, and followinggit.timeoutTesting
Claude ran these tests and I reviewed the results.
git_ignoredandgit_cleanon and off, and opening at the root, expanding after loading, or opening a file withfind_file. 14 were identical. The other 2 are the known difference documented in the option: withgit_clean,find_filecannot find the file while the status is loading.make lint,make check,make style,make style-doc,make format-checkandmake help-updatepass.I also tried it with my own configuration in the large repository, and opening it is clearly faster.