exrc.lua (540B)
1 -- For 'exrc' and related functionality. 2 3 local files = vim.fs.find({ '.nvim.lua', '.nvimrc', '.exrc' }, { 4 type = 'file', 5 upward = true, 6 limit = math.huge, 7 }) 8 for _, file in ipairs(files) do 9 local trusted = vim.secure.read(file) --[[@as string|nil]] 10 if trusted then 11 if vim.endswith(file, '.lua') then 12 assert(loadstring(trusted, '@' .. file))() 13 else 14 vim.api.nvim_exec2(trusted, {}) 15 end 16 end 17 -- If the user unset 'exrc' in the current exrc then stop searching 18 if not vim.o.exrc then 19 break 20 end 21 end