Skip to content

Commit

Permalink
feat: allow config of default for version field
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Nov 30, 2022
1 parent 334f32e commit fb96183
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions lua/lazy/core/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ M.defaults = {
plugins = "config.plugins",
defaults = {
opt = false, -- should plugins default to "opt" or "start"
version = nil,
-- version = "*", -- enable this to try installing the latest stable versions of plugins
},
dev = {
Expand Down
6 changes: 4 additions & 2 deletions lua/lazy/manage/git.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local Util = require("lazy.util")
local Semver = require("lazy.manage.semver")
local Config = require("lazy.core.config")

local M = {}

Expand Down Expand Up @@ -89,8 +90,9 @@ function M.get_target(plugin)
commit = M.ref(plugin.dir, "tags/" .. plugin.tag),
}
end
if plugin.version then
local last = Semver.last(M.get_versions(plugin.dir, plugin.version))
local version = plugin.version or Config.options.defaults.version
if version then
local last = Semver.last(M.get_versions(plugin.dir, version))
if last then
return {
branch = branch and branch.branch,
Expand Down

0 comments on commit fb96183

Please sign in to comment.