neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit dc6fc11b8753111a80f537dc762152d9adad2518
parent dc6885dc24c91f6465de985498cd02deed1aa0f8
Author: Yochem van Rosmalen <git@yochem.nl>
Date:   Mon, 19 May 2025 15:11:45 +0200

fix(defaults): start exrc search from parent directory

Problem:
The exrc file in the current directory is executed twice, here and in
`do_exrc_initalization()`.

Solution:
Start search from parent directory. Let core handle exrc in current
directory.

Diffstat:
Mruntime/lua/vim/_defaults.lua | 14+++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua @@ -928,13 +928,17 @@ do vim.api.nvim_create_autocmd('VimEnter', { group = vim.api.nvim_create_augroup('nvim.find_exrc', {}), - desc = 'Find project-local configuration', + desc = 'Find exrc files in parent directories', callback = function() if vim.o.exrc then - local files = vim.fs.find( - { '.nvim.lua', '.nvimrc', '.exrc' }, - { type = 'file', upward = true, limit = math.huge } - ) + -- Start from parent directory, as exrc file in the current + -- directory is already loaded in do_exrc_initalization(). + local files = vim.fs.find({ '.nvim.lua', '.nvimrc', '.exrc' }, { + type = 'file', + upward = true, + limit = math.huge, + 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