mirror of https://github.com/folke/lazy.nvim.git
parent
2f5c1be525
commit
aed842ae1e
|
@ -87,7 +87,8 @@ require("lazy").setup({
|
||||||
| **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 used |
|
| **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 specs that should be loaded when the plugin loads. Dependencies are always lazy-loaded unless specified otherwise |
|
| **dependencies** | `LazySpec[]` | A list of plugin specs that should be loaded when the plugin loads. Dependencies are always lazy-loaded unless specified otherwise |
|
||||||
| **init** | `fun(LazyPlugin)` | `init` functions are always executed during startup |
|
| **init** | `fun(LazyPlugin)` | `init` functions are always executed during startup |
|
||||||
| **config** | `fun(LazyPlugin)` or `true` or `table` | `config` is executed when the plugin loads. You can also set to `true` or pass a `table`, that will be passed to `require("plugin").setup(opts)` |
|
| **config** | `fun(LazyPlugin)` or `true` or `table` | `config` is executed when the plugin loads. You can also set to `true` or pass a `table`, that will be passed to `require("plugin").setup(opts)` |
|
||||||
|
|
|
@ -121,6 +121,11 @@ function M.load(plugins, reason)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if try_load and plugin.cond then
|
||||||
|
try_load = plugin.cond == true or (type(plugin.cond) == "function" and plugin.cond()) or false
|
||||||
|
plugin._.cond = try_load
|
||||||
|
end
|
||||||
|
|
||||||
---@cast plugin LazyPlugin
|
---@cast plugin LazyPlugin
|
||||||
|
|
||||||
if try_load and not plugin._.loaded then
|
if try_load and not plugin._.loaded then
|
||||||
|
|
|
@ -18,6 +18,7 @@ local M = {}
|
||||||
---@field cloned? boolean
|
---@field cloned? boolean
|
||||||
---@field kind? LazyPluginKind
|
---@field kind? LazyPluginKind
|
||||||
---@field dep? boolean True if this plugin is only in the spec as a dependency
|
---@field dep? boolean True if this plugin is only in the spec as a dependency
|
||||||
|
---@field cond? boolean
|
||||||
|
|
||||||
---@class LazyPluginHooks
|
---@class LazyPluginHooks
|
||||||
---@field init? fun(LazyPlugin) Will always be run
|
---@field init? fun(LazyPlugin) Will always be run
|
||||||
|
@ -44,6 +45,7 @@ local M = {}
|
||||||
---@field url string?
|
---@field url string?
|
||||||
---@field dir string
|
---@field dir string
|
||||||
---@field enabled? boolean|(fun():boolean)
|
---@field enabled? boolean|(fun():boolean)
|
||||||
|
---@field cond? boolean|(fun():boolean)
|
||||||
---@field lazy? boolean
|
---@field lazy? boolean
|
||||||
---@field dev? boolean If set, then link to the respective folder under your ~/projects
|
---@field dev? boolean If set, then link to the respective folder under your ~/projects
|
||||||
---@field dependencies? string[]
|
---@field dependencies? string[]
|
||||||
|
|
|
@ -15,6 +15,7 @@ M.colors = {
|
||||||
fg = "#ff007c",
|
fg = "#ff007c",
|
||||||
},
|
},
|
||||||
ProgressTodo = "LineNr",
|
ProgressTodo = "LineNr",
|
||||||
|
NoCond = "DiagnosticError",
|
||||||
Special = "@punctuation.special",
|
Special = "@punctuation.special",
|
||||||
HandlerRuntime = "@macro",
|
HandlerRuntime = "@macro",
|
||||||
HandlerPlugin = "Special",
|
HandlerPlugin = "Special",
|
||||||
|
|
|
@ -359,6 +359,8 @@ end
|
||||||
function M:plugin(plugin)
|
function M:plugin(plugin)
|
||||||
if plugin._.loaded then
|
if plugin._.loaded then
|
||||||
self:append(" ● ", "LazySpecial"):append(plugin.name)
|
self:append(" ● ", "LazySpecial"):append(plugin.name)
|
||||||
|
elseif plugin._.cond == false then
|
||||||
|
self:append(" ○ ", "LazyNoCond"):append(plugin.name)
|
||||||
else
|
else
|
||||||
self:append(" ○ ", "LazySpecial"):append(plugin.name)
|
self:append(" ○ ", "LazySpecial"):append(plugin.name)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue