From 6404d421555de681638907bdd4d0ab4f19774ce4 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 20 Dec 2022 13:47:53 +0100 Subject: [PATCH] fix: move re-sourcing check to the top --- lua/lazy/init.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lua/lazy/init.lua b/lua/lazy/init.lua index 3291c0a..ae4309b 100644 --- a/lua/lazy/init.lua +++ b/lua/lazy/init.lua @@ -4,6 +4,14 @@ 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 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 return end @@ -13,14 +21,6 @@ function M.setup(spec, opts) if not pcall(require, "ffi") then return vim.notify("lazy.nvim requires Neovim built with LuaJIT", vim.log.levels.ERROR, { title = "lazy.nvim" }) 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() if not (opts and opts.performance and opts.performance.cache and opts.performance.cache.enabled == false) then