diff options
| author | Yochem van Rosmalen <git@yochem.nl> | 2025-06-29 17:19:10 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-29 10:19:10 -0500 |
| commit | f7c939fa7af9744bcb6d79100a7e126f7e9c8f5c (patch) | |
| tree | 9e093432a76e557973923009ad7a64251384d0a6 /runtime/lua/vim/_defaults.lua | |
| parent | 2f95abddfaf8921555a7e252fc77ed26cbb4de5c (diff) | |
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 `"<nvim>"`.
Solution:
Include the filepath as chunkname in `loadstring()` and `nlua_exec()`.
Diffstat (limited to 'runtime/lua/vim/_defaults.lua')
| -rw-r--r-- | runtime/lua/vim/_defaults.lua | 2 |
1 files changed, 1 insertions, 1 deletions
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 |
