Merge remote-tracking branch 'upstream/main' into opmode_retrigger

This commit is contained in:
MurdeRM3L0DY 2023-02-05 21:24:41 +01:00
commit ad3a6b0bcf
13 changed files with 163 additions and 59 deletions

View file

@ -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: |

View file

@ -1,5 +1,37 @@
# 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)
### 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)

View file

@ -80,7 +80,7 @@ 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 |
@ -314,12 +314,17 @@ 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
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.
@ -330,6 +335,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 = {
@ -415,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 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",
@ -438,6 +444,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
}
```
@ -603,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
@ -620,7 +627,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.

View file

@ -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 February 01
==============================================================================
Table of Contents *lazy.nvim-table-of-contents*
@ -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|
@ -358,12 +358,17 @@ 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
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.
@ -374,6 +379,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 = {
@ -459,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 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",
@ -482,6 +488,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
}
<
@ -647,7 +654,7 @@ load your plugins.
<p class="caption">image</p>
</div>
🪲 DEBUG *lazy.nvim-🪲-debug*
DEBUG *lazy.nvim-debug*
See an overview of active lazy-loading handlers and whats in the module
cache
@ -669,7 +676,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.

View file

@ -21,12 +21,17 @@ 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
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.
@ -114,7 +119,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",
@ -141,7 +146,7 @@ M.defaults = {
debug = false,
}
M.version = "9.3.1" -- x-release-please-version
M.version = "9.5.0" -- x-release-please-version
M.ns = vim.api.nvim_create_namespace("lazy")

View file

@ -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

View file

@ -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)

View file

@ -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
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<string, ReadmeBlock|string>
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

View file

@ -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
@ -14,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

View file

@ -13,7 +13,14 @@ M.reported = {}
function M.start()
M.fast_check()
M.schedule()
if M.schedule() > 0 and not M.has_errors() then
Manage.log({
clear = false,
show = false,
check = true,
concurrency = Config.options.checker.concurrency,
})
end
end
function M.schedule()
@ -21,6 +28,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
@ -39,20 +47,23 @@ 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({
clear = false,
show = false,
concurrency = Config.options.checker.concurrency,
}):wait(function()

View file

@ -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
@ -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()

View file

@ -68,8 +68,10 @@ function M.spawn(cmd, opts)
for key, value in
pairs(uv.os_environ() --[[@as string[] ]])
do
if key ~= "GIT_DIR" then
table.insert(env, key .. "=" .. value)
end
end
local stdout = uv.new_pipe()
local stderr = uv.new_pipe()

View file

@ -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)
@ -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 })