perf: disable cache by default on VimEnter or on BufReadPre

This commit is contained in:
Folke Lemaitre 2022-12-03 18:59:28 +01:00
parent c1e44cbc3f
commit b2727d98a3
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 10 additions and 34 deletions

View file

@ -8,10 +8,9 @@ function M.setup(spec, opts)
end
local start = vim.loop.hrtime()
local Cache
if not (opts and opts.performance and opts.performance.cache and opts.performance.cache.enabled == false) then
-- load module cache before anything else
Cache = require("lazy.core.cache").setup(opts)
require("lazy.core.cache").setup(opts)
end
local Util = require("lazy.core.util")
@ -40,17 +39,9 @@ function M.setup(spec, opts)
Config.plugins["lazy.nvim"]._.loaded = { time = delta, source = "init.lua" }
end
if Cache then
Cache.disable("lazy")
end
-- load plugins with lazy=false or Plugin.init
Loader.init_plugins()
if Cache then
Cache.disable("init")
end
-- all done!
vim.cmd("do User LazyDone")
end