robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Justin M. KeyesMerge #40721 from justinmk/refactor4d736cd41f

master
536 B21 linesraw
1-- For 'exrc' and related functionality.
2
3local files = vim.fs.find({ '.nvim.lua', '.nvimrc', '.exrc' }, {
4  type = 'file',
5  upward = true,
6  limit = math.huge,
7})
8for _, 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
21end