mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-06-28 19:34:15 +00:00
Merge remote-tracking branch 'upstream/main' into opmode_retrigger
This commit is contained in:
commit
ad3a6b0bcf
13 changed files with 163 additions and 59 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -57,7 +57,7 @@ jobs:
|
||||||
package-name: lazy.nvim
|
package-name: lazy.nvim
|
||||||
extra-files: |
|
extra-files: |
|
||||||
lua/lazy/core/config.lua
|
lua/lazy/core/config.lua
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: tag stable versions
|
- name: tag stable versions
|
||||||
if: ${{ steps.release.outputs.release_created }}
|
if: ${{ steps.release.outputs.release_created }}
|
||||||
run: |
|
run: |
|
||||||
|
|
32
CHANGELOG.md
32
CHANGELOG.md
|
@ -1,5 +1,37 @@
|
||||||
# Changelog
|
# 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)
|
## [9.3.1](https://github.com/folke/lazy.nvim/compare/v9.3.0...v9.3.1) (2023-01-17)
|
||||||
|
|
||||||
|
|
||||||
|
|
65
README.md
65
README.md
|
@ -79,32 +79,32 @@ require("lazy").setup({
|
||||||
|
|
||||||
## 🔌 Plugin Spec
|
## 🔌 Plugin Spec
|
||||||
|
|
||||||
| Property | Type | Description |
|
| Property | Type | Description |
|
||||||
| ---------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ---------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `[1]` | `string?` | Short plugin url. Will be expanded using `config.git.url_format` |
|
| `[1]` | `string?` | Short plugin url. Will be expanded using `config.git.url_format` |
|
||||||
| **dir** | `string?` | A directory pointing to a local plugin |
|
| **dir** | `string?` | A directory pointing to a local plugin |
|
||||||
| **url** | `string?` | A custom git url where the plugin is hosted |
|
| **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 |
|
| **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` |
|
| **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 |
|
| **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 |
|
| **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. |
|
| **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. |
|
| **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 |
|
| **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()` |
|
| **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`. |
|
| **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 |
|
| **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 |
|
| **branch** | `string?` | Branch of the repository |
|
||||||
| **tag** | `string?` | Tag of the repository |
|
| **tag** | `string?` | Tag of the repository |
|
||||||
| **commit** | `string?` | Commit 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 |
|
| **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 |
|
| **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` |
|
| **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 |
|
| **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 |
|
| **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 |
|
| **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 |
|
| **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. |
|
| **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
|
### Lazy Loading
|
||||||
|
|
||||||
|
@ -314,12 +314,17 @@ return {
|
||||||
log = { "--since=3 days ago" }, -- show commits from the last 3 days
|
log = { "--since=3 days ago" }, -- show commits from the last 3 days
|
||||||
timeout = 120, -- kill processes that take more than 2 minutes
|
timeout = 120, -- kill processes that take more than 2 minutes
|
||||||
url_format = "https://github.com/%s.git",
|
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 = {
|
dev = {
|
||||||
-- directory where you store your local plugin projects
|
-- directory where you store your local plugin projects
|
||||||
path = "~/projects",
|
path = "~/projects",
|
||||||
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
|
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
|
||||||
patterns = {}, -- For example {"folke"}
|
patterns = {}, -- For example {"folke"}
|
||||||
|
fallback = false, -- Fallback to git when local plugin doesn't exist
|
||||||
},
|
},
|
||||||
install = {
|
install = {
|
||||||
-- install missing plugins on startup. This doesn't increase startup time.
|
-- install missing plugins on startup. This doesn't increase startup time.
|
||||||
|
@ -330,6 +335,7 @@ return {
|
||||||
ui = {
|
ui = {
|
||||||
-- a number <1 is a percentage., >1 is a fixed size
|
-- a number <1 is a percentage., >1 is a fixed size
|
||||||
size = { width = 0.8, height = 0.8 },
|
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()|.
|
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
|
||||||
border = "none",
|
border = "none",
|
||||||
icons = {
|
icons = {
|
||||||
|
@ -415,7 +421,7 @@ return {
|
||||||
rtp = {
|
rtp = {
|
||||||
reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory
|
reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory
|
||||||
---@type string[]
|
---@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
|
---@type string[] list any plugins you want to disable here
|
||||||
disabled_plugins = {
|
disabled_plugins = {
|
||||||
-- "gzip",
|
-- "gzip",
|
||||||
|
@ -438,6 +444,7 @@ return {
|
||||||
-- only generate markdown helptags for plugins that dont have docs
|
-- only generate markdown helptags for plugins that dont have docs
|
||||||
skip_if_doc_exists = true,
|
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.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 🪲 Debug
|
## 🐛 Debug
|
||||||
|
|
||||||
See an overview of active lazy-loading handlers and what's in the module cache
|
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
|
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)
|
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`)
|
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.
|
Files from runtime directories are always sourced in alphabetical order.
|
||||||
|
|
||||||
|
|
|
@ -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*
|
Table of Contents *lazy.nvim-table-of-contents*
|
||||||
|
@ -12,7 +12,7 @@ Table of Contents *lazy.nvim-table-of-contents*
|
||||||
- Usage |lazy.nvim-usage|
|
- Usage |lazy.nvim-usage|
|
||||||
- Lockfile `lazy-lock.json` |lazy.nvim-lockfile-`lazy-lock.json`|
|
- Lockfile `lazy-lock.json` |lazy.nvim-lockfile-`lazy-lock.json`|
|
||||||
- Performance |lazy.nvim-performance|
|
- Performance |lazy.nvim-performance|
|
||||||
- 🪲 Debug |lazy.nvim-🪲-debug|
|
- Debug |lazy.nvim-debug|
|
||||||
- Startup Sequence |lazy.nvim-startup-sequence|
|
- Startup Sequence |lazy.nvim-startup-sequence|
|
||||||
- Structuring Your Plugins |lazy.nvim-structuring-your-plugins|
|
- Structuring Your Plugins |lazy.nvim-structuring-your-plugins|
|
||||||
- Migration Guide |lazy.nvim-migration-guide|
|
- 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
|
log = { "--since=3 days ago" }, -- show commits from the last 3 days
|
||||||
timeout = 120, -- kill processes that take more than 2 minutes
|
timeout = 120, -- kill processes that take more than 2 minutes
|
||||||
url_format = "https://github.com/%s.git",
|
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 = {
|
dev = {
|
||||||
-- directory where you store your local plugin projects
|
-- directory where you store your local plugin projects
|
||||||
path = "~/projects",
|
path = "~/projects",
|
||||||
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
|
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
|
||||||
patterns = {}, -- For example {"folke"}
|
patterns = {}, -- For example {"folke"}
|
||||||
|
fallback = false, -- Fallback to git when local plugin doesn't exist
|
||||||
},
|
},
|
||||||
install = {
|
install = {
|
||||||
-- install missing plugins on startup. This doesn't increase startup time.
|
-- install missing plugins on startup. This doesn't increase startup time.
|
||||||
|
@ -374,6 +379,7 @@ CONFIGURATION *lazy.nvim-configuration*
|
||||||
ui = {
|
ui = {
|
||||||
-- a number <1 is a percentage., >1 is a fixed size
|
-- a number <1 is a percentage., >1 is a fixed size
|
||||||
size = { width = 0.8, height = 0.8 },
|
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()|.
|
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
|
||||||
border = "none",
|
border = "none",
|
||||||
icons = {
|
icons = {
|
||||||
|
@ -459,7 +465,7 @@ CONFIGURATION *lazy.nvim-configuration*
|
||||||
rtp = {
|
rtp = {
|
||||||
reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory
|
reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory
|
||||||
---@type string[]
|
---@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
|
---@type string[] list any plugins you want to disable here
|
||||||
disabled_plugins = {
|
disabled_plugins = {
|
||||||
-- "gzip",
|
-- "gzip",
|
||||||
|
@ -482,6 +488,7 @@ CONFIGURATION *lazy.nvim-configuration*
|
||||||
-- only generate markdown helptags for plugins that dont have docs
|
-- only generate markdown helptags for plugins that dont have docs
|
||||||
skip_if_doc_exists = true,
|
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>
|
<p class="caption">image</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
🪲 DEBUG *lazy.nvim-🪲-debug*
|
DEBUG *lazy.nvim-debug*
|
||||||
|
|
||||||
See an overview of active lazy-loading handlers and what’s in the module
|
See an overview of active lazy-loading handlers and what’s in the module
|
||||||
cache
|
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
|
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)
|
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`)
|
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.
|
Files from runtime directories are always sourced in alphabetical order.
|
||||||
|
|
|
@ -21,12 +21,17 @@ M.defaults = {
|
||||||
log = { "--since=3 days ago" }, -- show commits from the last 3 days
|
log = { "--since=3 days ago" }, -- show commits from the last 3 days
|
||||||
timeout = 120, -- kill processes that take more than 2 minutes
|
timeout = 120, -- kill processes that take more than 2 minutes
|
||||||
url_format = "https://github.com/%s.git",
|
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 = {
|
dev = {
|
||||||
-- directory where you store your local plugin projects
|
-- directory where you store your local plugin projects
|
||||||
path = "~/projects",
|
path = "~/projects",
|
||||||
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
|
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
|
||||||
patterns = {}, -- For example {"folke"}
|
patterns = {}, -- For example {"folke"}
|
||||||
|
fallback = false, -- Fallback to git when local plugin doesn't exist
|
||||||
},
|
},
|
||||||
install = {
|
install = {
|
||||||
-- install missing plugins on startup. This doesn't increase startup time.
|
-- install missing plugins on startup. This doesn't increase startup time.
|
||||||
|
@ -114,7 +119,7 @@ M.defaults = {
|
||||||
rtp = {
|
rtp = {
|
||||||
reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory
|
reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory
|
||||||
---@type string[]
|
---@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
|
---@type string[] list any plugins you want to disable here
|
||||||
disabled_plugins = {
|
disabled_plugins = {
|
||||||
-- "gzip",
|
-- "gzip",
|
||||||
|
@ -141,7 +146,7 @@ M.defaults = {
|
||||||
debug = false,
|
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")
|
M.ns = vim.api.nvim_create_namespace("lazy")
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,10 @@ function Spec:add(plugin, results, is_dep)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- dev plugins
|
-- 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
|
plugin.dir = Config.options.dev.path .. "/" .. plugin.name
|
||||||
else
|
else
|
||||||
-- remote plugin
|
-- remote plugin
|
||||||
|
|
|
@ -201,6 +201,22 @@ function M.walk(path, fn)
|
||||||
end)
|
end)
|
||||||
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 modname string
|
||||||
---@param fn fun(modname:string, modpath:string)
|
---@param fn fun(modname:string, modpath:string)
|
||||||
function M.lsmod(modname, fn)
|
function M.lsmod(modname, fn)
|
||||||
|
|
|
@ -14,21 +14,27 @@ end
|
||||||
function M.fix_indent(str)
|
function M.fix_indent(str)
|
||||||
local lines = vim.split(str, "\n")
|
local lines = vim.split(str, "\n")
|
||||||
|
|
||||||
|
local first = table.remove(lines, 1)
|
||||||
|
|
||||||
local width = 120
|
local width = 120
|
||||||
for _, line in ipairs(lines) do
|
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
|
end
|
||||||
|
|
||||||
for l, line in ipairs(lines) do
|
for l, line in ipairs(lines) do
|
||||||
lines[l] = line:sub(width + 1)
|
lines[l] = line:sub(width + 1)
|
||||||
end
|
end
|
||||||
|
table.insert(lines, 1, first)
|
||||||
return table.concat(lines, "\n")
|
return table.concat(lines, "\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
---@alias ReadmeBlock {content:string, lang?:string}
|
---@alias ReadmeBlock {content:string, lang?:string}
|
||||||
---@param contents table<string, ReadmeBlock|string>
|
---@param contents table<string, ReadmeBlock|string>
|
||||||
function M.save(contents)
|
---@param readme_file? string
|
||||||
local readme = Util.read_file("README.md")
|
function M.save(contents, readme_file)
|
||||||
|
local readme = Util.read_file(readme_file or "README.md")
|
||||||
for tag, block in pairs(contents) do
|
for tag, block in pairs(contents) do
|
||||||
if type(block) == "string" then
|
if type(block) == "string" then
|
||||||
block = { content = block, lang = "lua" }
|
block = { content = block, lang = "lua" }
|
||||||
|
@ -48,7 +54,7 @@ function M.save(contents)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Util.write_file("README.md", readme)
|
Util.write_file(readme_file or "README.md", readme)
|
||||||
vim.cmd.checktime()
|
vim.cmd.checktime()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,12 @@ local M = {}
|
||||||
function M.check()
|
function M.check()
|
||||||
vim.health.report_start("lazy.nvim")
|
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 sites = vim.opt.packpath:get()
|
||||||
local default_site = vim.fn.stdpath("data") .. "/site"
|
local default_site = vim.fn.stdpath("data") .. "/site"
|
||||||
if not vim.tbl_contains(sites, default_site) then
|
if not vim.tbl_contains(sites, default_site) then
|
||||||
|
@ -14,7 +20,7 @@ function M.check()
|
||||||
local existing = false
|
local existing = false
|
||||||
for _, site in pairs(sites) do
|
for _, site in pairs(sites) do
|
||||||
for _, packs in ipairs(vim.fn.expand(site .. "/pack/*", false, true)) 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
|
existing = true
|
||||||
vim.health.report_warn("found existing packages at `" .. packs .. "`")
|
vim.health.report_warn("found existing packages at `" .. packs .. "`")
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,14 @@ M.reported = {}
|
||||||
|
|
||||||
function M.start()
|
function M.start()
|
||||||
M.fast_check()
|
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
|
end
|
||||||
|
|
||||||
function M.schedule()
|
function M.schedule()
|
||||||
|
@ -21,6 +28,7 @@ function M.schedule()
|
||||||
local next_check = State.checker.last_check + Config.options.checker.frequency - os.time()
|
local next_check = State.checker.last_check + Config.options.checker.frequency - os.time()
|
||||||
next_check = math.max(next_check, 0)
|
next_check = math.max(next_check, 0)
|
||||||
vim.defer_fn(M.check, next_check * 1000)
|
vim.defer_fn(M.check, next_check * 1000)
|
||||||
|
return next_check
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param opts? {report:boolean} report defaults to true
|
---@param opts? {report:boolean} report defaults to true
|
||||||
|
@ -39,20 +47,23 @@ function M.fast_check(opts)
|
||||||
M.report(opts.report ~= false)
|
M.report(opts.report ~= false)
|
||||||
end
|
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()
|
function M.check()
|
||||||
State.checker.last_check = os.time()
|
State.checker.last_check = os.time()
|
||||||
State.write() -- update state
|
State.write() -- update state
|
||||||
local errors = false
|
if M.has_errors() then
|
||||||
for _, plugin in pairs(Config.plugins) do
|
|
||||||
if Plugin.has_errors(plugin) then
|
|
||||||
errors = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if errors then
|
|
||||||
M.schedule()
|
M.schedule()
|
||||||
else
|
else
|
||||||
Manage.check({
|
Manage.check({
|
||||||
|
clear = false,
|
||||||
show = false,
|
show = false,
|
||||||
concurrency = Config.options.checker.concurrency,
|
concurrency = Config.options.checker.concurrency,
|
||||||
}):wait(function()
|
}):wait(function()
|
||||||
|
|
|
@ -136,13 +136,13 @@ function M.check(opts)
|
||||||
}, opts)
|
}, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param opts? ManagerOpts
|
---@param opts? ManagerOpts | {check?:boolean}
|
||||||
function M.log(opts)
|
function M.log(opts)
|
||||||
opts = M.opts(opts, { mode = "log" })
|
opts = M.opts(opts, { mode = "log" })
|
||||||
return M.run({
|
return M.run({
|
||||||
pipeline = {
|
pipeline = {
|
||||||
{ "git.origin", check = true },
|
{ "git.origin", check = true },
|
||||||
"git.log",
|
{ "git.log", check = opts.check },
|
||||||
},
|
},
|
||||||
plugins = function(plugin)
|
plugins = function(plugin)
|
||||||
return plugin.url and plugin._.installed
|
return plugin.url and plugin._.installed
|
||||||
|
@ -174,7 +174,10 @@ function M.sync(opts)
|
||||||
end)
|
end)
|
||||||
opts.show = false
|
opts.show = false
|
||||||
end
|
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 install = M.install(opts)
|
||||||
local update = M.update(opts)
|
local update = M.update(opts)
|
||||||
clean:wait(function()
|
clean:wait(function()
|
||||||
|
|
|
@ -68,7 +68,9 @@ function M.spawn(cmd, opts)
|
||||||
for key, value in
|
for key, value in
|
||||||
pairs(uv.os_environ() --[[@as string[] ]])
|
pairs(uv.os_environ() --[[@as string[] ]])
|
||||||
do
|
do
|
||||||
table.insert(env, key .. "=" .. value)
|
if key ~= "GIT_DIR" then
|
||||||
|
table.insert(env, key .. "=" .. value)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local stdout = uv.new_pipe()
|
local stdout = uv.new_pipe()
|
||||||
|
|
|
@ -15,7 +15,7 @@ M.log = {
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
local stat = vim.loop.fs_stat(plugin.dir .. "/.git")
|
local stat = vim.loop.fs_stat(plugin.dir .. "/.git")
|
||||||
return stat and stat.type ~= "directory"
|
return not (stat and stat.type == "directory")
|
||||||
end,
|
end,
|
||||||
---@param opts {args?: string[], updated?:boolean, check?:boolean}
|
---@param opts {args?: string[], updated?:boolean, check?:boolean}
|
||||||
run = function(self, opts)
|
run = function(self, opts)
|
||||||
|
@ -64,10 +64,16 @@ M.clone = {
|
||||||
local args = {
|
local args = {
|
||||||
"clone",
|
"clone",
|
||||||
self.plugin.url,
|
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",
|
"--recurse-submodules",
|
||||||
"--progress",
|
"--progress",
|
||||||
}
|
})
|
||||||
|
|
||||||
if self.plugin.branch then
|
if self.plugin.branch then
|
||||||
vim.list_extend(args, { "-b", self.plugin.branch })
|
vim.list_extend(args, { "-b", self.plugin.branch })
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue