fix(exrc): ensure consistent 'exrc' loading sequence #35148

Problem:
The execution of startup scripts in parent directories are too late
compared to scripts in current direcctory.

Solution:
Execute all startup scripts with `lua/_core/exrc.lua`.

closes: #35147
This commit is contained in:
€šm̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰�Ř§Ů Â£╟©舐æØ¢£ðsÞ¥¿—
2025-12-09 03:22:10 +00:00
committed by GitHub
parent 2f9f77cd72
commit ed9abb1851
3 changed files with 28 additions and 60 deletions

View File

@@ -952,37 +952,6 @@ do
end
end
vim.api.nvim_create_autocmd('VimEnter', {
group = vim.api.nvim_create_augroup('nvim.exrc', {}),
desc = 'Find exrc files in parent directories',
callback = function()
if not vim.o.exrc then
return
end
local files = vim.fs.find({ '.nvim.lua', '.nvimrc', '.exrc' }, {
type = 'file',
upward = true,
limit = math.huge,
-- exrc in cwd already handled from C, thus start in parent directory.
path = vim.fs.dirname((vim.uv.cwd())),
})
for _, file in ipairs(files) do
local trusted = vim.secure.read(file) --[[@as string|nil]]
if trusted then
if vim.endswith(file, '.lua') then
assert(loadstring(trusted, '@' .. file))()
else
vim.api.nvim_exec2(trusted, {})
end
end
-- If the user unset 'exrc' in the current exrc then stop searching
if not vim.o.exrc then
return
end
end
end,
})
if tty then
-- Show progress bars in supporting terminals
vim.api.nvim_create_autocmd('Progress', {