From 3f8cc2c0dfa46849c472f4e22247991f2c26db7b Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 19 Jan 2023 22:08:58 +0100 Subject: [PATCH 01/29] docs: generated docs --- README.md | 54 ++++++++++++++++++++++++----------------------- lua/lazy/docs.lua | 14 ++++++++---- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index b5c7b9a..b5a197d 100644 --- a/README.md +++ b/README.md @@ -79,32 +79,32 @@ require("lazy").setup({ ## 🔌 Plugin Spec -| Property | Type | Description | -| ---------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `[1]` | `string?` | Short plugin url. Will be expanded using `config.git.url_format` | -| **dir** | `string?` | A directory pointing to a local plugin | -| **url** | `string?` | A custom git url where the plugin is hosted | -| **name** | `string?` | A custom name for the plugin used for the local plugin directory and as the display name | -| **dev** | `boolean?` | When `true`, a local plugin directory will be used instead. See `config.dev` | -| **lazy** | `boolean?` | When `true`, the plugin will only be loaded when needed. Lazy-loaded plugins are automatically loaded when their Lua modules are `required`, or when one of the lazy-loading handlers triggers | -| **enabled** | `boolean?` or `fun():boolean` | When `false`, or if the `function` returns false, then this plugin will not be included in the spec | -| **cond** | `boolean?` or `fun():boolean` | When `false`, or if the `function` returns false, then this plugin will not be loaded. Useful to disable some plugins in vscode, or firenvim for example. | -| **dependencies** | `LazySpec[]` | A list of plugin names or plugin specs that should be loaded when the plugin loads. Dependencies are always lazy-loaded unless specified otherwise. When specifying a name, make sure the plugin spec has been defined somewhere else. | -| **init** | `fun(LazyPlugin)` | `init` functions are always executed during startup | -| **opts** | `table` or `fun(LazyPlugin, opts:table)` | `opts` should be a table (will be merged with parent specs), return a table (replaces parent specs) or should change a table. The table will be passed to the `Plugin.config()` function. Setting this value will imply `Plugin.config()` | -| **config** | `fun(LazyPlugin, opts:table)` or `true` | `config` is executed when the plugin loads. The default implementation will automatically run `require("plugin").setup(opts)`. `"plugin"` will default to `name` if specified, otherwise `lazy.nvim` will do its best to guess the correct plugin name. See also `opts`. To use the default implementation without `opts` set `config` to `true`. | -| **build** | `fun(LazyPlugin)` or `string` or a list of build commands | `build` is executed when a plugin is installed or updated. If it's a string it will be ran as a shell command. When prefixed with `:` it is a Neovim command. You can also specify a list to executed multiple build commands | -| **branch** | `string?` | Branch of the repository | -| **tag** | `string?` | Tag of the repository | -| **commit** | `string?` | Commit of the repository | -| **version** | `string?` | Version to use from the repository. Full [Semver](https://devhints.io/semver) ranges are supported | -| **pin** | `boolean?` | When `true`, this plugin will not be included in updates | -| **event** | `string?` or `string[]` or `fun(self:LazyPlugin, event:string[]):string[]` | Lazy-load on event. Events can be specified as `BufEnter` or with a pattern like `BufEnter *.lua` | -| **cmd** | `string?` or `string[]` or `fun(self:LazyPlugin, cmd:string[]):string[]` | Lazy-load on command | -| **ft** | `string?` or `string[]` or `fun(self:LazyPlugin, ft:string[]):string[]` | Lazy-load on filetype | -| **keys** | `string?` or `string[]` or `LazyKeys[]` or `fun(self:LazyPlugin, keys:string[]):(string \| LazyKeys)[]` | Lazy-load on key mapping | -| **module** | `false?` | Do not automatically load this Lua module when it's required somewhere | -| **priority** | `number?` | Only useful for **start** plugins (`lazy=false`) to force loading certain plugins first. Default priority is `50`. It's recommended to set this to a high number for colorschemes. | +| Property | Type | Description | +| ---------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `[1]` | `string?` | Short plugin url. Will be expanded using `config.git.url_format` | +| **dir** | `string?` | A directory pointing to a local plugin | +| **url** | `string?` | A custom git url where the plugin is hosted | +| **name** | `string?` | A custom name for the plugin used for the local plugin directory and as the display name | +| **dev** | `boolean?` | When `true`, a local plugin directory will be used instead. See `config.dev` | +| **lazy** | `boolean?` | When `true`, the plugin will only be loaded when needed. Lazy-loaded plugins are automatically loaded when their Lua modules are `required`, or when one of the lazy-loading handlers triggers | +| **enabled** | `boolean?` or `fun():boolean` | When `false`, or if the `function` returns false, then this plugin will not be included in the spec | +| **cond** | `boolean?` or `fun():boolean` | When `false`, or if the `function` returns false, then this plugin will not be loaded. Useful to disable some plugins in vscode, or firenvim for example. | +| **dependencies** | `LazySpec[]` | A list of plugin names or plugin specs that should be loaded when the plugin loads. Dependencies are always lazy-loaded unless specified otherwise. When specifying a name, make sure the plugin spec has been defined somewhere else. | +| **init** | `fun(LazyPlugin)` | `init` functions are always executed during startup | +| **opts** | `table` or `fun(LazyPlugin, opts:table)` | `opts` should be a table (will be merged with parent specs), return a table (replaces parent specs) or should change a table. The table will be passed to the `Plugin.config()` function. Setting this value will imply `Plugin.config()` | +| **config** | `fun(LazyPlugin, opts:table)` or `true` | `config` is executed when the plugin loads. The default implementation will automatically run `require("plugin").setup(opts)`. `"plugin"` will default to `name` if specified, otherwise `lazy.nvim` will do its best to guess the correct plugin name. See also `opts`. To use the default implementation without `opts` set `config` to `true`. | +| **build** | `fun(LazyPlugin)` or `string` or a list of build commands | `build` is executed when a plugin is installed or updated. If it's a string it will be ran as a shell command. When prefixed with `:` it is a Neovim command. You can also specify a list to executed multiple build commands | +| **branch** | `string?` | Branch of the repository | +| **tag** | `string?` | Tag of the repository | +| **commit** | `string?` | Commit of the repository | +| **version** | `string?` | Version to use from the repository. Full [Semver](https://devhints.io/semver) ranges are supported | +| **pin** | `boolean?` | When `true`, this plugin will not be included in updates | +| **event** | `string?` or `string[]` or `fun(self:LazyPlugin, event:string[]):string[]` | Lazy-load on event. Events can be specified as `BufEnter` or with a pattern like `BufEnter *.lua` | +| **cmd** | `string?` or `string[]` or `fun(self:LazyPlugin, cmd:string[]):string[]` | Lazy-load on command | +| **ft** | `string?` or `string[]` or `fun(self:LazyPlugin, ft:string[]):string[]` | Lazy-load on filetype | +| **keys** | `string?` or `string[]` or `LazyKeys[]` or `fun(self:LazyPlugin, keys:string[]):(string \| LazyKeys)[]` | Lazy-load on key mapping | +| **module** | `false?` | Do not automatically load this Lua module when it's required somewhere | +| **priority** | `number?` | Only useful for **start** plugins (`lazy=false`) to force loading certain plugins first. Default priority is `50`. It's recommended to set this to a high number for colorschemes. | ### Lazy Loading @@ -330,6 +330,7 @@ return { ui = { -- a number <1 is a percentage., >1 is a fixed size size = { width = 0.8, height = 0.8 }, + wrap = true, -- wrap the lines in the ui -- The border to use for the UI window. Accepts same border values as |nvim_open_win()|. border = "none", icons = { @@ -438,6 +439,7 @@ return { -- only generate markdown helptags for plugins that dont have docs skip_if_doc_exists = true, }, + state = vim.fn.stdpath("state") .. "/lazy/state.json", -- state info for checker and other things } ``` diff --git a/lua/lazy/docs.lua b/lua/lazy/docs.lua index 44bddfa..da3a166 100644 --- a/lua/lazy/docs.lua +++ b/lua/lazy/docs.lua @@ -14,21 +14,27 @@ end function M.fix_indent(str) local lines = vim.split(str, "\n") + local first = table.remove(lines, 1) + local width = 120 for _, line in ipairs(lines) do - width = math.min(width, #line:match("^%s*")) + if not line:find("^%s*$") then + width = math.min(width, #line:match("^%s*")) + end end for l, line in ipairs(lines) do lines[l] = line:sub(width + 1) end + table.insert(lines, 1, first) return table.concat(lines, "\n") end ---@alias ReadmeBlock {content:string, lang?:string} ---@param contents table -function M.save(contents) - local readme = Util.read_file("README.md") +---@param readme_file? string +function M.save(contents, readme_file) + local readme = Util.read_file(readme_file or "README.md") for tag, block in pairs(contents) do if type(block) == "string" then block = { content = block, lang = "lua" } @@ -48,7 +54,7 @@ function M.save(contents) end end - Util.write_file("README.md", readme) + Util.write_file(readme_file or "README.md", readme) vim.cmd.checktime() end From 75dcd5741d76e09b1a41c771fbc8b010a109b5cb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 19 Jan 2023 21:09:52 +0000 Subject: [PATCH 02/29] chore(build): auto-generate vimdoc --- doc/lazy.nvim.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/lazy.nvim.txt b/doc/lazy.nvim.txt index caee52f..4e6f21d 100644 --- a/doc/lazy.nvim.txt +++ b/doc/lazy.nvim.txt @@ -374,6 +374,7 @@ CONFIGURATION *lazy.nvim-configuration* ui = { -- a number <1 is a percentage., >1 is a fixed size size = { width = 0.8, height = 0.8 }, + wrap = true, -- wrap the lines in the ui -- The border to use for the UI window. Accepts same border values as |nvim_open_win()|. border = "none", icons = { @@ -482,6 +483,7 @@ CONFIGURATION *lazy.nvim-configuration* -- only generate markdown helptags for plugins that dont have docs skip_if_doc_exists = true, }, + state = vim.fn.stdpath("state") .. "/lazy/state.json", -- state info for checker and other things } < From 9858001c3cdb5713e8d1aeb0f47c23038084fd7c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 20 Jan 2023 20:41:29 +0100 Subject: [PATCH 03/29] fix(git): unset GIT_DIR when spawning a process. Fixes #434 --- lua/lazy/manage/process.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazy/manage/process.lua b/lua/lazy/manage/process.lua index 79279a0..2ddcff1 100644 --- a/lua/lazy/manage/process.lua +++ b/lua/lazy/manage/process.lua @@ -68,7 +68,9 @@ function M.spawn(cmd, opts) for key, value in pairs(uv.os_environ() --[[@as string[] ]]) do - table.insert(env, key .. "=" .. value) + if key ~= "GIT_DIR" then + table.insert(env, key .. "=" .. value) + end end local stdout = uv.new_pipe() From 96d759d1cbd8b0bd0ea0a0c2987f99410272f348 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 20 Jan 2023 19:42:27 +0000 Subject: [PATCH 04/29] chore(build): auto-generate vimdoc --- doc/lazy.nvim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/lazy.nvim.txt b/doc/lazy.nvim.txt index 4e6f21d..c09b21e 100644 --- a/doc/lazy.nvim.txt +++ b/doc/lazy.nvim.txt @@ -1,4 +1,4 @@ -*lazy.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 January 19 +*lazy.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 January 20 ============================================================================== Table of Contents *lazy.nvim-table-of-contents* From 4008b57d882065814ce27a0f32609d5ea437a6e9 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 22 Jan 2023 14:30:12 +0100 Subject: [PATCH 05/29] fix(checker): make sure we show logs when only doing a fast check --- lua/lazy/manage/checker.lua | 9 ++++++++- lua/lazy/manage/init.lua | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lua/lazy/manage/checker.lua b/lua/lazy/manage/checker.lua index 7622812..5798b4f 100644 --- a/lua/lazy/manage/checker.lua +++ b/lua/lazy/manage/checker.lua @@ -13,7 +13,13 @@ M.reported = {} function M.start() M.fast_check() - M.schedule() + if M.schedule() > 0 then + Manage.log({ + show = false, + check = true, + concurrency = Config.options.checker.concurrency, + }) + end end function M.schedule() @@ -21,6 +27,7 @@ function M.schedule() local next_check = State.checker.last_check + Config.options.checker.frequency - os.time() next_check = math.max(next_check, 0) vim.defer_fn(M.check, next_check * 1000) + return next_check end ---@param opts? {report:boolean} report defaults to true diff --git a/lua/lazy/manage/init.lua b/lua/lazy/manage/init.lua index 9ffda73..c4a4da0 100644 --- a/lua/lazy/manage/init.lua +++ b/lua/lazy/manage/init.lua @@ -136,13 +136,13 @@ function M.check(opts) }, opts) end ----@param opts? ManagerOpts +---@param opts? ManagerOpts | {check?:boolean} function M.log(opts) opts = M.opts(opts, { mode = "log" }) return M.run({ pipeline = { { "git.origin", check = true }, - "git.log", + { "git.log", check = opts.check }, }, plugins = function(plugin) return plugin.url and plugin._.installed From fc3104c44b9a140381daf4bdf8d0454988317a93 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Jan 2023 13:31:18 +0000 Subject: [PATCH 06/29] chore(build): auto-generate vimdoc --- doc/lazy.nvim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/lazy.nvim.txt b/doc/lazy.nvim.txt index c09b21e..06c47a8 100644 --- a/doc/lazy.nvim.txt +++ b/doc/lazy.nvim.txt @@ -1,4 +1,4 @@ -*lazy.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 January 20 +*lazy.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 January 22 ============================================================================== Table of Contents *lazy.nvim-table-of-contents* From 7674ee6254279cd5df7db92b41d3a2ca027bde55 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 22 Jan 2023 15:18:43 +0100 Subject: [PATCH 07/29] chore(main): release 9.4.0 (#417) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 16 ++++++++++++++++ lua/lazy/core/config.lua | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2093139..a84145b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## [9.4.0](https://github.com/folke/lazy.nvim/compare/v9.3.1...v9.4.0) (2023-01-22) + + +### Features + +* added `config.ui.wrap` and improved wrapping when wrap=true. Fixes [#422](https://github.com/folke/lazy.nvim/issues/422) ([d6fc848](https://github.com/folke/lazy.nvim/commit/d6fc848067d603800b9e63a7b22b7e5853c6bd7a)) +* **checker:** checker will now save last check time and only check at configured frequency even after restarting Neovim ([813fc94](https://github.com/folke/lazy.nvim/commit/813fc944d797fe1b43abe12866a9ef7af403c35c)) + + +### Bug Fixes + +* **checker:** make sure we show logs when only doing a fast check ([4008b57](https://github.com/folke/lazy.nvim/commit/4008b57d882065814ce27a0f32609d5ea437a6e9)) +* **git:** unset GIT_DIR when spawning a process. Fixes [#434](https://github.com/folke/lazy.nvim/issues/434) ([9858001](https://github.com/folke/lazy.nvim/commit/9858001c3cdb5713e8d1aeb0f47c23038084fd7c)) +* **render:** get profile_{sort,filter} key bindings from ViewConfig ([#416](https://github.com/folke/lazy.nvim/issues/416)) ([27ca918](https://github.com/folke/lazy.nvim/commit/27ca918bc3d02ea20b3fd901c8919e9925555444)) +* **spec:** dont complain about an invalid short url, when a full url is set. Fixes [#421](https://github.com/folke/lazy.nvim/issues/421) ([c389ad5](https://github.com/folke/lazy.nvim/commit/c389ad552bd5c2050783ac6cd6e54f5fbba3c7bc)) + ## [9.3.1](https://github.com/folke/lazy.nvim/compare/v9.3.0...v9.3.1) (2023-01-17) diff --git a/lua/lazy/core/config.lua b/lua/lazy/core/config.lua index 0140c53..035714e 100644 --- a/lua/lazy/core/config.lua +++ b/lua/lazy/core/config.lua @@ -141,7 +141,7 @@ M.defaults = { debug = false, } -M.version = "9.3.1" -- x-release-please-version +M.version = "9.4.0" -- x-release-please-version M.ns = vim.api.nvim_create_namespace("lazy") From 21871f2269b7121da2aa5683d9de06ab00a05ba2 Mon Sep 17 00:00:00 2001 From: Sizhe Zhao Date: Sun, 22 Jan 2023 22:23:26 +0800 Subject: [PATCH 08/29] docs: Fix typo in README.md (#433) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b5a197d..a3a2972 100644 --- a/README.md +++ b/README.md @@ -416,7 +416,7 @@ return { rtp = { reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory ---@type string[] - paths = {}, -- add any custom paths here that you want to indluce in the rtp + paths = {}, -- add any custom paths here that you want to include in the rtp ---@type string[] list any plugins you want to disable here disabled_plugins = { -- "gzip", @@ -622,7 +622,7 @@ In practice this means that step 10 of [Neovim Initialization](https://neovim.io 1. all the plugins' `init()` functions are executed 2. all plugins with `lazy=false` are loaded. This includes sourcing `/plugin` and `/ftdetect` files. (`/after` will not be sourced yet) 3. all files from `/plugin` and `/ftdetect` directories in you rtp are sourced (excluding `/after`) -4. all `/after/plugin` files are sourced (this inludes `/after` from plugins) +4. all `/after/plugin` files are sourced (this includes `/after` from plugins) Files from runtime directories are always sourced in alphabetical order. From 908d71872b4b783e8d80eb13ad5b07212a9731df Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 22 Jan 2023 15:24:13 +0100 Subject: [PATCH 09/29] docs: typo --- lua/lazy/core/config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazy/core/config.lua b/lua/lazy/core/config.lua index 035714e..ec30ee0 100644 --- a/lua/lazy/core/config.lua +++ b/lua/lazy/core/config.lua @@ -114,7 +114,7 @@ M.defaults = { rtp = { reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory ---@type string[] - paths = {}, -- add any custom paths here that you want to indluce in the rtp + paths = {}, -- add any custom paths here that you want to includes in the rtp ---@type string[] list any plugins you want to disable here disabled_plugins = { -- "gzip", From cab4682d22a0451bc36a648694235621b5dd808e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Jan 2023 14:25:05 +0000 Subject: [PATCH 10/29] chore(build): auto-generate vimdoc --- doc/lazy.nvim.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/lazy.nvim.txt b/doc/lazy.nvim.txt index 06c47a8..86345f5 100644 --- a/doc/lazy.nvim.txt +++ b/doc/lazy.nvim.txt @@ -460,7 +460,7 @@ CONFIGURATION *lazy.nvim-configuration* rtp = { reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory ---@type string[] - paths = {}, -- add any custom paths here that you want to indluce in the rtp + paths = {}, -- add any custom paths here that you want to include in the rtp ---@type string[] list any plugins you want to disable here disabled_plugins = { -- "gzip", @@ -671,7 +671,7 @@ In practice this means that step 10 of |Neovim Initialization| is done by Lazy: 1. all the plugins’ `init()` functions are executed 2. all plugins with `lazy=false` are loaded. This includes sourcing `/plugin` and `/ftdetect` files. (`/after` will not be sourced yet) 3. all files from `/plugin` and `/ftdetect` directories in you rtp are sourced (excluding `/after`) -4. all `/after/plugin` files are sourced (this inludes `/after` from plugins) +4. all `/after/plugin` files are sourced (this includes `/after` from plugins) Files from runtime directories are always sourced in alphabetical order. From ed210702f5dc8c24ec6531c0f2484881d9ebe6b6 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 23 Jan 2023 19:17:11 +0100 Subject: [PATCH 11/29] fix(checker): dont clear tasks when running update check --- lua/lazy/manage/checker.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/lazy/manage/checker.lua b/lua/lazy/manage/checker.lua index 5798b4f..d45d513 100644 --- a/lua/lazy/manage/checker.lua +++ b/lua/lazy/manage/checker.lua @@ -15,6 +15,7 @@ function M.start() M.fast_check() if M.schedule() > 0 then Manage.log({ + clear = false, show = false, check = true, concurrency = Config.options.checker.concurrency, @@ -60,6 +61,7 @@ function M.check() M.schedule() else Manage.check({ + clear = false, show = false, concurrency = Config.options.checker.concurrency, }):wait(function() From c32a6185ace7cb04572db1637a3010b729a7601e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 23 Jan 2023 19:17:30 +0100 Subject: [PATCH 12/29] fix(checker): dont check for updates when there's tasks with errors --- lua/lazy/manage/checker.lua | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lua/lazy/manage/checker.lua b/lua/lazy/manage/checker.lua index d45d513..1cc5322 100644 --- a/lua/lazy/manage/checker.lua +++ b/lua/lazy/manage/checker.lua @@ -13,7 +13,7 @@ M.reported = {} function M.start() M.fast_check() - if M.schedule() > 0 then + if M.schedule() > 0 and not M.has_errors() then Manage.log({ clear = false, show = false, @@ -47,17 +47,19 @@ function M.fast_check(opts) M.report(opts.report ~= false) end +function M.has_errors() + for _, plugin in pairs(Config.plugins) do + if Plugin.has_errors(plugin) then + return true + end + end + return false +end + function M.check() State.checker.last_check = os.time() State.write() -- update state - local errors = false - for _, plugin in pairs(Config.plugins) do - if Plugin.has_errors(plugin) then - errors = true - break - end - end - if errors then + if M.has_errors() then M.schedule() else Manage.check({ From 26a67e3c48951ca3ce47d208c3216143749b0768 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 23 Jan 2023 19:18:15 +0100 Subject: [PATCH 13/29] feat(config): added option to disable git filter. NOT recommended. Fixes #442 --- lua/lazy/core/config.lua | 4 ++++ lua/lazy/manage/task/git.lua | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lua/lazy/core/config.lua b/lua/lazy/core/config.lua index ec30ee0..dd1bdae 100644 --- a/lua/lazy/core/config.lua +++ b/lua/lazy/core/config.lua @@ -21,6 +21,10 @@ M.defaults = { log = { "--since=3 days ago" }, -- show commits from the last 3 days timeout = 120, -- kill processes that take more than 2 minutes url_format = "https://github.com/%s.git", + -- lazy.nvim requires git >=2.19.0. If you really want to use lazy with an older version, + -- then set the below to false. This is should work, but is NOT supported and will + -- increase downloads a lot. + filter = true, }, dev = { -- directory where you store your local plugin projects diff --git a/lua/lazy/manage/task/git.lua b/lua/lazy/manage/task/git.lua index c314c90..f07fce0 100644 --- a/lua/lazy/manage/task/git.lua +++ b/lua/lazy/manage/task/git.lua @@ -64,10 +64,16 @@ M.clone = { local args = { "clone", self.plugin.url, - "--filter=blob:none", + } + + if Config.options.git.filter then + args[#args + 1] = "--filter=blob:none" + end + + vim.list_extend(args, { "--recurse-submodules", "--progress", - } + }) if self.plugin.branch then vim.list_extend(args, { "-b", self.plugin.branch }) From 5d9d35404f39de5d7c9365cbc2aa39858929cbfc Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 23 Jan 2023 19:18:48 +0100 Subject: [PATCH 14/29] feat(util): utility method to walk over all modules in a directory --- lua/lazy/core/util.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lua/lazy/core/util.lua b/lua/lazy/core/util.lua index 7411664..fd2cce4 100644 --- a/lua/lazy/core/util.lua +++ b/lua/lazy/core/util.lua @@ -201,6 +201,22 @@ function M.walk(path, fn) end) end +---@param root string +---@param fn fun(modname:string, modpath:string) +---@param modname? string +function M.walkmods(root, fn, modname) + modname = modname and (modname:gsub("%.$", "") .. ".") or "" + M.ls(root, function(path, name, type) + if name == "init.lua" then + fn(modname:gsub("%.$", ""), path) + elseif (type == "file" or type == "link") and name:sub(-4) == ".lua" then + fn(modname .. name:sub(1, -5), path) + elseif type == "directory" then + M.walkmods(path, fn, modname .. name .. ".") + end + end) +end + ---@param modname string ---@param fn fun(modname:string, modpath:string) function M.lsmod(modname, fn) From 9e0b8c399f54d9853abea85ed737e6476917e96c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 23 Jan 2023 18:19:49 +0000 Subject: [PATCH 15/29] chore(build): auto-generate vimdoc --- doc/lazy.nvim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/lazy.nvim.txt b/doc/lazy.nvim.txt index 86345f5..403c7f8 100644 --- a/doc/lazy.nvim.txt +++ b/doc/lazy.nvim.txt @@ -1,4 +1,4 @@ -*lazy.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 January 22 +*lazy.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 January 23 ============================================================================== Table of Contents *lazy.nvim-table-of-contents* From 809d67fcf0f6dd5dabdd1c2b88d451cef4695880 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 23 Jan 2023 20:49:44 +0100 Subject: [PATCH 16/29] ci: update actions/checkout to v3 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8046e5a..94b6d15 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,7 +57,7 @@ jobs: package-name: lazy.nvim extra-files: | lua/lazy/core/config.lua - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: tag stable versions if: ${{ steps.release.outputs.release_created }} run: | From 772d8888cc6f8e4371c31001197431b24311af48 Mon Sep 17 00:00:00 2001 From: Null Chilly <56817415+nullchilly@users.noreply.github.com> Date: Wed, 25 Jan 2023 04:55:34 +0700 Subject: [PATCH 17/29] feat(dev): optionally fallback to git when local plugin doesn't exist (#446) * feat: fallback to git when local plugin isn't found * feat(option): fallback to git when local plugin doesn't exist --- README.md | 1 + lua/lazy/core/config.lua | 1 + lua/lazy/core/plugin.lua | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a3a2972..20f0134 100644 --- a/README.md +++ b/README.md @@ -320,6 +320,7 @@ return { path = "~/projects", ---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub patterns = {}, -- For example {"folke"} + fallback = false, -- Fallback to git when local plugin doesn't exist }, install = { -- install missing plugins on startup. This doesn't increase startup time. diff --git a/lua/lazy/core/config.lua b/lua/lazy/core/config.lua index dd1bdae..e0b50f0 100644 --- a/lua/lazy/core/config.lua +++ b/lua/lazy/core/config.lua @@ -31,6 +31,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"} + fallback = false, -- Fallback to git when local plugin doesn't exist }, install = { -- install missing plugins on startup. This doesn't increase startup time. diff --git a/lua/lazy/core/plugin.lua b/lua/lazy/core/plugin.lua index 4873249..b79cc6b 100644 --- a/lua/lazy/core/plugin.lua +++ b/lua/lazy/core/plugin.lua @@ -91,7 +91,10 @@ function Spec:add(plugin, results, is_dep) end end -- dev plugins - if plugin.dev then + if + plugin.dev + and (not Config.options.dev.fallback or vim.fn.isdirectory(Config.options.dev.path .. "/" .. plugin.name) == 1) + then plugin.dir = Config.options.dev.path .. "/" .. plugin.name else -- remote plugin From 39c4770d8137e9cb304e68b779396c7d0a3c8ec2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 24 Jan 2023 21:56:22 +0000 Subject: [PATCH 18/29] chore(build): auto-generate vimdoc --- doc/lazy.nvim.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/lazy.nvim.txt b/doc/lazy.nvim.txt index 403c7f8..86a2198 100644 --- a/doc/lazy.nvim.txt +++ b/doc/lazy.nvim.txt @@ -1,4 +1,4 @@ -*lazy.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 January 23 +*lazy.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 January 24 ============================================================================== Table of Contents *lazy.nvim-table-of-contents* @@ -364,6 +364,7 @@ CONFIGURATION *lazy.nvim-configuration* path = "~/projects", ---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub patterns = {}, -- For example {"folke"} + fallback = false, -- Fallback to git when local plugin doesn't exist }, install = { -- install missing plugins on startup. This doesn't increase startup time. From 9b5cc1bf53f344c8ad829f33c3ac77f5e3ea8da1 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 24 Jan 2023 08:48:14 +0100 Subject: [PATCH 19/29] feat(health): check for git in health checks --- lua/lazy/health.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/lazy/health.lua b/lua/lazy/health.lua index 59fa139..31fbd50 100644 --- a/lua/lazy/health.lua +++ b/lua/lazy/health.lua @@ -5,6 +5,12 @@ local M = {} function M.check() vim.health.report_start("lazy.nvim") + if vim.fn.executable("git") == 1 then + vim.health.report_ok("Git installed") + else + vim.health.report_error("Git not installd?") + end + local sites = vim.opt.packpath:get() local default_site = vim.fn.stdpath("data") .. "/site" if not vim.tbl_contains(sites, default_site) then From 31dd419aaa0bfbab1c827465aa153efbe6b95e1f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 24 Jan 2023 23:01:11 +0100 Subject: [PATCH 20/29] docs: updated --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 20f0134..40ffda8 100644 --- a/README.md +++ b/README.md @@ -314,6 +314,10 @@ return { log = { "--since=3 days ago" }, -- show commits from the last 3 days timeout = 120, -- kill processes that take more than 2 minutes url_format = "https://github.com/%s.git", + -- lazy.nvim requires git >=2.19.0. If you really want to use lazy with an older version, + -- then set the below to false. This is should work, but is NOT supported and will + -- increase downloads a lot. + filter = true, }, dev = { -- directory where you store your local plugin projects @@ -417,7 +421,7 @@ return { rtp = { reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory ---@type string[] - paths = {}, -- add any custom paths here that you want to include in the rtp + paths = {}, -- add any custom paths here that you want to includes in the rtp ---@type string[] list any plugins you want to disable here disabled_plugins = { -- "gzip", From a24331762cc41df636d9d3541aafa301f958cf4a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 24 Jan 2023 22:01:59 +0000 Subject: [PATCH 21/29] chore(build): auto-generate vimdoc --- doc/lazy.nvim.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/lazy.nvim.txt b/doc/lazy.nvim.txt index 86a2198..357cc29 100644 --- a/doc/lazy.nvim.txt +++ b/doc/lazy.nvim.txt @@ -358,6 +358,10 @@ CONFIGURATION *lazy.nvim-configuration* log = { "--since=3 days ago" }, -- show commits from the last 3 days timeout = 120, -- kill processes that take more than 2 minutes url_format = "https://github.com/%s.git", + -- lazy.nvim requires git >=2.19.0. If you really want to use lazy with an older version, + -- then set the below to false. This is should work, but is NOT supported and will + -- increase downloads a lot. + filter = true, }, dev = { -- directory where you store your local plugin projects @@ -461,7 +465,7 @@ CONFIGURATION *lazy.nvim-configuration* rtp = { reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory ---@type string[] - paths = {}, -- add any custom paths here that you want to include in the rtp + paths = {}, -- add any custom paths here that you want to includes in the rtp ---@type string[] list any plugins you want to disable here disabled_plugins = { -- "gzip", From 9b208696e139a404d159963b975a5b90af38439b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 25 Jan 2023 09:10:46 +0100 Subject: [PATCH 22/29] chore(main): release 9.5.0 (#444) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 16 ++++++++++++++++ lua/lazy/core/config.lua | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a84145b..c7949e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## [9.5.0](https://github.com/folke/lazy.nvim/compare/v9.4.0...v9.5.0) (2023-01-24) + + +### Features + +* **config:** added option to disable git filter. NOT recommended. Fixes [#442](https://github.com/folke/lazy.nvim/issues/442) ([26a67e3](https://github.com/folke/lazy.nvim/commit/26a67e3c48951ca3ce47d208c3216143749b0768)) +* **dev:** optionally fallback to git when local plugin doesn't exist ([#446](https://github.com/folke/lazy.nvim/issues/446)) ([772d888](https://github.com/folke/lazy.nvim/commit/772d8888cc6f8e4371c31001197431b24311af48)) +* **health:** check for git in health checks ([9b5cc1b](https://github.com/folke/lazy.nvim/commit/9b5cc1bf53f344c8ad829f33c3ac77f5e3ea8da1)) +* **util:** utility method to walk over all modules in a directory ([5d9d354](https://github.com/folke/lazy.nvim/commit/5d9d35404f39de5d7c9365cbc2aa39858929cbfc)) + + +### Bug Fixes + +* **checker:** dont check for updates when there's tasks with errors ([c32a618](https://github.com/folke/lazy.nvim/commit/c32a6185ace7cb04572db1637a3010b729a7601e)) +* **checker:** dont clear tasks when running update check ([ed21070](https://github.com/folke/lazy.nvim/commit/ed210702f5dc8c24ec6531c0f2484881d9ebe6b6)) + ## [9.4.0](https://github.com/folke/lazy.nvim/compare/v9.3.1...v9.4.0) (2023-01-22) diff --git a/lua/lazy/core/config.lua b/lua/lazy/core/config.lua index e0b50f0..79bef28 100644 --- a/lua/lazy/core/config.lua +++ b/lua/lazy/core/config.lua @@ -146,7 +146,7 @@ M.defaults = { debug = false, } -M.version = "9.4.0" -- x-release-please-version +M.version = "9.5.0" -- x-release-please-version M.ns = vim.api.nvim_create_namespace("lazy") From b64ebb71d4e573a34b0b83801eee60cc6d86a06e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 25 Jan 2023 08:27:21 +0000 Subject: [PATCH 23/29] chore(build): auto-generate vimdoc --- doc/lazy.nvim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/lazy.nvim.txt b/doc/lazy.nvim.txt index 357cc29..f4674d6 100644 --- a/doc/lazy.nvim.txt +++ b/doc/lazy.nvim.txt @@ -1,4 +1,4 @@ -*lazy.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 January 24 +*lazy.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 January 25 ============================================================================== Table of Contents *lazy.nvim-table-of-contents* From 07fda7bb9808b4848aaabd9400357c56cfbda6d7 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 25 Jan 2023 22:33:45 +0100 Subject: [PATCH 24/29] docs: use another bug emoji. #452 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 40ffda8..c272438 100644 --- a/README.md +++ b/README.md @@ -610,7 +610,7 @@ The profiling view shows you why and how long it took to load your plugins. ![image](https://user-images.githubusercontent.com/292349/208301766-5c400561-83c3-4811-9667-1ec4bb3c43b8.png) -## 🪲 Debug +## 🐛 Debug See an overview of active lazy-loading handlers and what's in the module cache From 15fe46a728b7473d4cae368838bbc1c79c3a3f48 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 25 Jan 2023 21:34:44 +0000 Subject: [PATCH 25/29] chore(build): auto-generate vimdoc --- doc/lazy.nvim.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/lazy.nvim.txt b/doc/lazy.nvim.txt index f4674d6..05b1beb 100644 --- a/doc/lazy.nvim.txt +++ b/doc/lazy.nvim.txt @@ -12,7 +12,7 @@ Table of Contents *lazy.nvim-table-of-contents* - Usage |lazy.nvim-usage| - Lockfile `lazy-lock.json` |lazy.nvim-lockfile-`lazy-lock.json`| - Performance |lazy.nvim-performance| - - 🪲 Debug |lazy.nvim-🪲-debug| + - Debug |lazy.nvim-debug| - Startup Sequence |lazy.nvim-startup-sequence| - Structuring Your Plugins |lazy.nvim-structuring-your-plugins| - Migration Guide |lazy.nvim-migration-guide| @@ -654,7 +654,7 @@ load your plugins.

image

-🪲 DEBUG *lazy.nvim-🪲-debug* +DEBUG *lazy.nvim-debug* See an overview of active lazy-loading handlers and what’s in the module cache From 0c980312fd6bce744db499acfa5af47871287151 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 1 Feb 2023 08:06:48 +0100 Subject: [PATCH 26/29] fix(commands): sync with plugins list should not delete those plugins. Fixes #475 --- lua/lazy/manage/init.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/lazy/manage/init.lua b/lua/lazy/manage/init.lua index c4a4da0..34fc065 100644 --- a/lua/lazy/manage/init.lua +++ b/lua/lazy/manage/init.lua @@ -174,7 +174,10 @@ function M.sync(opts) end) opts.show = false end - local clean = M.clean(opts) + + local clean_opts = vim.deepcopy(opts) + clean_opts.plugins = nil + local clean = M.clean(clean_opts) local install = M.install(opts) local update = M.update(opts) clean:wait(function() From c83563d34acd20cbd5180e40442f2e0f095fb3ff Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 1 Feb 2023 07:08:28 +0000 Subject: [PATCH 27/29] chore(build): auto-generate vimdoc --- doc/lazy.nvim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/lazy.nvim.txt b/doc/lazy.nvim.txt index 05b1beb..c4b8119 100644 --- a/doc/lazy.nvim.txt +++ b/doc/lazy.nvim.txt @@ -1,4 +1,4 @@ -*lazy.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 January 25 +*lazy.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 February 01 ============================================================================== Table of Contents *lazy.nvim-table-of-contents* From 527f83cae50b99d16327447eb813b4f73e09ec0d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 1 Feb 2023 08:08:44 +0100 Subject: [PATCH 28/29] fix(health): existing packages on windows. Fixes #474 --- lua/lazy/health.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazy/health.lua b/lua/lazy/health.lua index 31fbd50..75a85a6 100644 --- a/lua/lazy/health.lua +++ b/lua/lazy/health.lua @@ -20,7 +20,7 @@ function M.check() local existing = false for _, site in pairs(sites) do for _, packs in ipairs(vim.fn.expand(site .. "/pack/*", false, true)) do - if not packs:find("/dist$") and vim.loop.fs_stat(packs) then + if not packs:find("[/\\]dist$") and vim.loop.fs_stat(packs) then existing = true vim.health.report_warn("found existing packages at `" .. packs .. "`") end From 3d2dcb2d5ef99106c5ff412da88c6f59a9f8a693 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 1 Feb 2023 08:26:20 +0100 Subject: [PATCH 29/29] fix(log): properly check if plugin dir is a git repo before running git log --- lua/lazy/manage/task/git.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazy/manage/task/git.lua b/lua/lazy/manage/task/git.lua index f07fce0..377b3ef 100644 --- a/lua/lazy/manage/task/git.lua +++ b/lua/lazy/manage/task/git.lua @@ -15,7 +15,7 @@ M.log = { return true end local stat = vim.loop.fs_stat(plugin.dir .. "/.git") - return stat and stat.type ~= "directory" + return not (stat and stat.type == "directory") end, ---@param opts {args?: string[], updated?:boolean, check?:boolean} run = function(self, opts)