feat: dont run setup again when a user re-sources their config & show a warning

This commit is contained in:
Folke Lemaitre 2022-12-03 23:46:50 +01:00
parent 3f517abfa4
commit 7b945eec58
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 3 additions and 1 deletions

View File

@ -3,9 +3,11 @@ local M = {}
---@param spec LazySpec Should be a module name to load, or a plugin spec
---@param opts? LazyConfig
function M.setup(spec, opts)
if not vim.go.loadplugins then
if not vim.go.loadplugins or vim.g.lazy_did_setup then
vim.notify("Re-sourcing your config is not supported with lazy.nvim", vim.log.levels.WARN, { title = "lazy.nvim" })
return
end
vim.g.lazy_did_setup = true
local start = vim.loop.hrtime()
if not (opts and opts.performance and opts.performance.cache and opts.performance.cache.enabled == false) then