feat: add option to use lua patterns for dev patterns

This commit is contained in:
Fredrik Averpil 2024-07-24 22:13:24 +02:00
commit 90d12dad08
No known key found for this signature in database
3 changed files with 7 additions and 1 deletions

View file

@ -667,6 +667,7 @@ will be added to the plugins spec.
path = "~/projects",
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
patterns = {}, -- For example {"folke"}
plain = true, -- true uses plain string matching for the patterns, false uses Lua patterns
fallback = false, -- Fallback to git when local plugin doesn't exist
},
install = {

View file

@ -71,6 +71,7 @@ M.defaults = {
path = "~/projects",
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
patterns = {}, -- For example {"folke"}
plain = true, -- true uses plain string matching for the patterns, false uses Lua patterns
fallback = false, -- Fallback to git when local plugin doesn't exist
},
install = {

View file

@ -215,8 +215,12 @@ function M:_rebuild(name)
plugin.dir = Util.norm(plugin.dir)
else
if plugin.dev == nil and plugin.url then
local plain = Config.options.dev.plain
if plain == nil then
plain = true -- Default to true if not set
end
for _, pattern in ipairs(Config.options.dev.patterns) do
if plugin.url:find(pattern, 1, true) then
if plugin.url:find(pattern, 1, plain) then
plugin.dev = true
break
end