summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/lua/vim/_ftplugin/lua.lua
diff options
context:
space:
mode:
authorPhạm Bình An <111893501+brianhuster@users.noreply.github.com>2025-05-06 19:15:31 +0700
committerGitHub <noreply@github.com>2025-05-06 05:15:31 -0700
commitdb2b774a16414a7b964736c0e896ddd40d25ca3f (patch)
tree3809158d620958d8ad98f0996204e8586db07582 /runtime/lua/vim/_ftplugin/lua.lua
parent8d75910ef9689b601087cf9bc59ec2622771490a (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.lua12
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