fix: move re-sourcing check to the top

This commit is contained in:
Folke Lemaitre 2022-12-20 13:47:53 +01:00
parent ddf36d7748
commit 6404d42155
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 8 additions and 8 deletions

View File

@ -4,6 +4,14 @@ local M = {}
---@param spec LazySpec Should be a module name to load, or a plugin spec ---@param spec LazySpec Should be a module name to load, or a plugin spec
---@param opts? LazyConfig ---@param opts? LazyConfig
function M.setup(spec, opts) function M.setup(spec, opts)
if vim.g.lazy_did_setup then
return vim.notify(
"Re-sourcing your config is not supported with lazy.nvim",
vim.log.levels.WARN,
{ title = "lazy.nvim" }
)
end
vim.g.lazy_did_setup = true
if not vim.go.loadplugins then if not vim.go.loadplugins then
return return
end end
@ -13,14 +21,6 @@ function M.setup(spec, opts)
if not pcall(require, "ffi") then if not pcall(require, "ffi") then
return vim.notify("lazy.nvim requires Neovim built with LuaJIT", vim.log.levels.ERROR, { title = "lazy.nvim" }) return vim.notify("lazy.nvim requires Neovim built with LuaJIT", vim.log.levels.ERROR, { title = "lazy.nvim" })
end end
if vim.g.lazy_did_setup then
return vim.notify(
"Re-sourcing your config is not supported with lazy.nvim",
vim.log.levels.WARN,
{ title = "lazy.nvim" }
)
end
vim.g.lazy_did_setup = true
local start = vim.loop.hrtime() local start = vim.loop.hrtime()
if not (opts and opts.performance and opts.performance.cache and opts.performance.cache.enabled == false) then if not (opts and opts.performance and opts.performance.cache and opts.performance.cache.enabled == false) then