perf: added option to reset rtp to just your config and the neovim runtime

This commit is contained in:
Folke Lemaitre 2022-12-03 17:42:54 +01:00
parent 6affae6454
commit ccc506d5f7
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 10 additions and 0 deletions

View File

@ -54,6 +54,7 @@ M.defaults = {
---@type LazyCacheConfig ---@type LazyCacheConfig
cache = nil, cache = nil,
reset_packpath = true, -- packpath will be reset to only include lazy. This makes packadd a lot faster reset_packpath = true, -- packpath will be reset to only include lazy. This makes packadd a lot faster
reset_rtp = true,
}, },
debug = false, debug = false,
} }
@ -83,6 +84,15 @@ function M.setup(spec, opts)
if M.options.performance.reset_packpath then if M.options.performance.reset_packpath then
vim.go.packpath = "" vim.go.packpath = ""
end end
if M.options.performance.reset_rtp then
local me = debug.getinfo(1, "S").source:sub(2)
me = vim.fn.fnamemodify(me, ":p:h:h:h:h")
vim.opt.rtp = {
vim.fn.stdpath("config"),
"$VIMRUNTIME",
me,
}
end
vim.api.nvim_create_autocmd("User", { vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy", pattern = "VeryLazy",