Files
neovim/runtime/lua/vim/_core/exrc.lua
€šm̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰�Ř§Ů Â£╟©舐æØ¢£ðsÞ¥¿— ed9abb1851 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
2025-12-08 22:22:10 -05:00

20 lines
498 B
Lua

local files = vim.fs.find({ '.nvim.lua', '.nvimrc', '.exrc' }, {
type = 'file',
upward = true,
limit = math.huge,
})
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
break
end
end