Skip to content

Commit

Permalink
feat: added checks for Neovim version
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Dec 14, 2022
1 parent 675dece commit 72f64ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lua/lazy/core/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ function M.setup(spec, opts)
}
end

-- disable plugin loading since we do all of that ourselves
vim.go.loadplugins = false

vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy",
once = true,
Expand Down
10 changes: 8 additions & 2 deletions lua/lazy/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ 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 or vim.g.lazy_did_setup then
if vim.fn.has("nvim-0.8.0") ~= 1 then
vim.notify("lazy.nvim requires Neovim >= 0.8.0", vim.log.levels.ERROR, { title = "lazy.nvim" })
return
end
if not vim.go.loadplugins then
return
end
if 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.go.loadplugins = false

vim.g.lazy_did_setup = true
local start = vim.loop.hrtime()
Expand Down

0 comments on commit 72f64ce

Please sign in to comment.