diff options
| author | Phạm Bình An <111893501+brianhuster@users.noreply.github.com> | 2025-05-06 19:15:31 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-06 05:15:31 -0700 |
| commit | db2b774a16414a7b964736c0e896ddd40d25ca3f (patch) | |
| tree | 3809158d620958d8ad98f0996204e8586db07582 /runtime/lua/vim/_ftplugin/lua.lua | |
| parent | 8d75910ef9689b601087cf9bc59ec2622771490a (diff) | |
fix(runtime): 'includeexpr' with non-Nvim-style Lua modules #33867
Closes #33862
Diffstat (limited to 'runtime/lua/vim/_ftplugin/lua.lua')
| -rw-r--r-- | runtime/lua/vim/_ftplugin/lua.lua | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/runtime/lua/vim/_ftplugin/lua.lua b/runtime/lua/vim/_ftplugin/lua.lua index d81393192d..778817a665 100644 --- a/runtime/lua/vim/_ftplugin/lua.lua +++ b/runtime/lua/vim/_ftplugin/lua.lua @@ -3,13 +3,15 @@ local M = {} --- @param module string ---@return string function M.includeexpr(module) - local fname = module:gsub('%.', '/') + module = module:gsub('%.', '/') local root = vim.fs.root(vim.api.nvim_buf_get_name(0), 'lua') or vim.fn.getcwd() - for _, suf in ipairs { '.lua', '/init.lua' } do - local path = vim.fs.joinpath(root, 'lua', fname .. suf) - if vim.uv.fs_stat(path) then - return path + for _, fname in ipairs { module, vim.fs.joinpath(root, 'lua', module) } do + for _, suf in ipairs { '.lua', '/init.lua' } do + local path = fname .. suf + if vim.uv.fs_stat(path) then + return path + end end end |
