From f7c939fa7af9744bcb6d79100a7e126f7e9c8f5c Mon Sep 17 00:00:00 2001 From: Yochem van Rosmalen Date: Sun, 29 Jun 2025 17:19:10 +0200 Subject: fix(exrc): exrc knows its own location (#34638) fix(exrc): lua exrc files know their location Problem: 'exrc' files are inherently bound to their location / workspace and therefore require to "know" their location on the filesystem. However, currently using `debug.getinfo(1, 'S')` returns `""`. Solution: Include the filepath as chunkname in `loadstring()` and `nlua_exec()`. --- runtime/lua/vim/_defaults.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/_defaults.lua') diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index a51b08ed7a..1661829011 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -956,7 +956,7 @@ do local trusted = vim.secure.read(file) --[[@as string|nil]] if trusted then if vim.endswith(file, '.lua') then - assert(loadstring(trusted))() + assert(loadstring(trusted, '@' .. file))() else vim.api.nvim_exec2(trusted, {}) end -- cgit