feat(config): show an error when the needed version of lazy.nvim is too old

This commit is contained in:
Folke Lemaitre committed 2023-01-10 11:14:27 +01:00
1 parent 48d1e8df12
commit 7b943822db
1 file changed
+13
+13
View File
@@ -1,6 +1,8 @@
---@type LazyVimConfig
local M = {}
M.lazy_version = ">=9.1.0"
---@class LazyVimConfig
local defaults = {
icons = {
@@ -60,6 +62,17 @@ local options
---@param opts? LazyVimConfig
function M.setup(opts)
options = vim.tbl_deep_extend("force", defaults, opts or {})
if not M.has() then
require("lazy.core.util").error(
"**LazyVim** needs **lazy.nvim** version "
.. M.lazy_version
.. " to work properly.\n"
.. "Please upgrade **lazy.nvim**",
{ title = "LazyVim" }
)
end
end
---@param range? string
function M.has(range)
local Semver = require("lazy.manage.semver")