Skip to content

Commit fb96183

Browse files
committed
feat: allow config of default for version field
1 parent 334f32e commit fb96183

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lua/lazy/core/config.lua

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ M.defaults = {
77
plugins = "config.plugins",
88
defaults = {
99
opt = false, -- should plugins default to "opt" or "start"
10+
version = nil,
1011
-- version = "*", -- enable this to try installing the latest stable versions of plugins
1112
},
1213
dev = {

lua/lazy/manage/git.lua

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
local Util = require("lazy.util")
22
local Semver = require("lazy.manage.semver")
3+
local Config = require("lazy.core.config")
34

45
local M = {}
56

@@ -89,8 +90,9 @@ function M.get_target(plugin)
8990
commit = M.ref(plugin.dir, "tags/" .. plugin.tag),
9091
}
9192
end
92-
if plugin.version then
93-
local last = Semver.last(M.get_versions(plugin.dir, plugin.version))
93+
local version = plugin.version or Config.options.defaults.version
94+
if version then
95+
local last = Semver.last(M.get_versions(plugin.dir, version))
9496
if last then
9597
return {
9698
branch = branch and branch.branch,

0 commit comments

Comments
 (0)