From 90d12dad081b397135afa20d3e8428dea180c27f Mon Sep 17 00:00:00 2001 From: Fredrik Averpil Date: Wed, 24 Jul 2024 22:13:24 +0200 Subject: [PATCH] feat: add option to use lua patterns for dev patterns --- doc/lazy.nvim.txt | 1 + lua/lazy/core/config.lua | 1 + lua/lazy/core/meta.lua | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/lazy.nvim.txt b/doc/lazy.nvim.txt index c2c9695..f03a427 100644 --- a/doc/lazy.nvim.txt +++ b/doc/lazy.nvim.txt @@ -667,6 +667,7 @@ will be added to the plugin’s 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 = { diff --git a/lua/lazy/core/config.lua b/lua/lazy/core/config.lua index 1a8dba7..02f4302 100644 --- a/lua/lazy/core/config.lua +++ b/lua/lazy/core/config.lua @@ -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 = { diff --git a/lua/lazy/core/meta.lua b/lua/lazy/core/meta.lua index 6e781a0..00be902 100644 --- a/lua/lazy/core/meta.lua +++ b/lua/lazy/core/meta.lua @@ -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