diff --git a/lua/lualine/utils/loader.lua b/lua/lualine/utils/loader.lua index ef9d159..d8e5547 100644 --- a/lua/lualine/utils/loader.lua +++ b/lua/lualine/utils/loader.lua @@ -224,8 +224,8 @@ end local function load_theme(theme_name) assert(is_valid_filename(theme_name), 'Invalid filename') local retval - local path = table.concat({ 'lua', 'lualine', 'themes', theme_name }, sep) .. '.lua' - local files = lualine_require.rtp_searcher(path) + local path = table.concat { 'lua/lualine/themes/', theme_name, '.lua' } + local files = vim.api.nvim_get_runtime_file(path, true) local n_files = #files if n_files == 0 then -- No match found diff --git a/lua/lualine_require.lua b/lua/lualine_require.lua index 4d86887..6aa35f7 100644 --- a/lua/lualine_require.lua +++ b/lua/lualine_require.lua @@ -35,7 +35,8 @@ function M.require(module) end end - local paths = M.rtp_searcher('lua' .. M.sep .. pattern, true) + pattern = table.concat { 'lua/', module:gsub('%.', '/'), '.lua' } + local paths = vim.api.nvim_get_runtime_file(pattern, false) if #paths > 0 then local mod_result = dofile(paths[1]) package.loaded[module] = mod_result @@ -45,20 +46,6 @@ function M.require(module) return require(module) end -function M.rtp_searcher(file, once) - local ret = {} - for _, dir in ipairs(vim.api.nvim_list_runtime_paths()) do - local path = dir .. M.sep .. file - if vim.loop.fs_stat(path) then - ret[#ret + 1] = path - if once then - break - end - end - end - return ret -end - function M.lazy_require(modules) return setmetatable({}, { __index = function(self, key)