feat(config): show NeoTree on VimEnter before restoring session

This commit is contained in:
Prad Nukala committed 2026-10-14 11:38:23 -04:00
1 parent 29bac037b3
commit ec38b89179
3 files changed
+10 -58

No files matched your search

-46
View File
@@ -1,46 +0,0 @@
# .understandignore — patterns for files/dirs to exclude from analysis
# Syntax: same as .gitignore (globs, # comments, ! negation, trailing / for dirs)
# Lines below are suggestions — uncomment to activate.
# Use ! prefix to force-include something excluded by defaults.
#
# Built-in defaults (always excluded unless negated):
# node_modules/, .git/, dist/, build/, obj/, *.lock, *.min.js, etc.
#
# --- From .gitignore (uncomment to exclude) ---
/.omc
/.omc/state
# Generated plugin lockfile — pinned versions only, no architecture signal
lazy-lock.json
# --- Test file patterns (uncomment to exclude) ---
# JS / TS
# *.test.*
# *.spec.*
# *.snap
# C# / .NET
# **/*Tests.cs
# **/*Test.cs
# **/*Fixture.cs
# **/*.Tests.csproj
# Java / Kotlin
# **/src/test/**
# **/*Test.java
# **/*IT.java
# **/*Spec.kt
# Go
# **/*_test.go
# C++
# **/*_test.cc
# **/*_test.cpp
# **/*_test.cxx
# **/*Test.cc
# **/*Test.cpp
# **/*_unittest.cc
# **/*_unittest.cpp
# **/*_browsertest.cc
# **/*_benchmark.cc
# **/*Benchmark.cpp
-3
View File
@@ -1,3 +0,0 @@
{
"outputLanguage": "en"
}
+10 -9
View File
@@ -73,20 +73,21 @@ local function pick_files()
end end
end end
--- VimEnter entry point: restore this worktree/branch session, or fall back to --- VimEnter entry point: show neo-tree, then restore this worktree/branch
--- the file picker when none has been saved yet. --- session, or fall back to the file picker when none has been saved yet.
--- ---
--- Exception: when nvim was started with file arguments (`nvim foo.lua`, a --- Exception: when nvim was started with file arguments (`nvim foo.lua`, a
--- directory, or `-`) the requested buffer is what the user asked for, so --- directory, or `-`) the requested buffer is what the user asked for, so
--- neither the session nor the picker may take the screen. --- neither the tree, the session nor the picker may take the screen.
function M.restore() function M.restore()
if vim.fn.argc(-1) > 0 then return end if vim.fn.argc(-1) > 0 then return end
if M.exists(M.name()) then local restored = M.exists(M.name())
M.load { silence_errors = true } if restored then M.load { silence_errors = true } end
else -- defer so the tree and picker open after startup finished drawing the UI
-- defer so the picker opens after startup finished drawing the UI vim.schedule(function()
vim.schedule(pick_files) vim.cmd "Neotree show" -- no focus: the restored buffer / picker keeps it
end if not restored then pick_files() end
end)
end end
return M return M