fix(cache): properly get rtp during fast events

This commit is contained in:
Folke Lemaitre 2022-12-29 01:25:05 +01:00
parent 55335138ce
commit 95b9cf743c
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 6 additions and 5 deletions

View File

@ -241,7 +241,7 @@ function M.find(modname)
local modpath = _find()
if not modpath then
-- update rtp
local rtp = vim.api.nvim_list_runtime_paths()
local rtp = M.list_rtp()
if #rtp ~= M.indexed_rtp then
M.indexed_rtp = #rtp
local updated = false
@ -283,10 +283,7 @@ end
-- returns the cached RTP excluding plugin dirs
function M.get_rtp()
if vim.in_fast_event() then
return M.rtp or {}
end
local rtp = vim.api.nvim_list_runtime_paths()
local rtp = M.list_rtp()
if not M.rtp or #rtp ~= M.rtp_total then
M.rtp_total = #rtp
M.rtp = {}
@ -313,6 +310,10 @@ function M.get_rtp()
return M.rtp
end
function M.list_rtp()
return vim.api.nvim_get_runtime_file("", true)
end
---@param opts? LazyConfig
function M.setup(opts)
-- no fancy deep extend here. just set the options