diff --git a/README.md b/README.md index 65d5631..9c5555c 100644 --- a/README.md +++ b/README.md @@ -498,7 +498,7 @@ Any operation can be started from the UI, with a sub command or an API function: | `:Lazy help` | `require("lazy").help()` | Toggle this help page | | `:Lazy home` | `require("lazy").home()` | Go back to plugin list | | `:Lazy install [plugins]` | `require("lazy").install(opts?)` | Install missing plugins | -| `:Lazy load {plugins}` | `require("lazy").load(opts)` | Load a plugin that has not been loaded yet. Similar to `:packadd`. Like `:Lazy load foo.nvim` | +| `:Lazy load(!) {plugins}` | `require("lazy").load(opts)` | Load a plugin that has not been loaded yet. Similar to `:packadd`. Like `:Lazy load foo.nvim`. `load!` will force load the plugin, ignoring `cond` | | `:Lazy log [plugins]` | `require("lazy").log(opts?)` | Show recent updates | | `:Lazy profile` | `require("lazy").profile()` | Show detailed profiling | | `:Lazy restore [plugins]` | `require("lazy").restore(opts?)` | Updates all plugins to the state in the lockfile. For a single plugin: restore it to the state in the lockfile or to a given commit under the cursor | diff --git a/lua/lazy/core/loader.lua b/lua/lazy/core/loader.lua index c2bc844..9a2e662 100644 --- a/lua/lazy/core/loader.lua +++ b/lua/lazy/core/loader.lua @@ -187,7 +187,8 @@ function M._load(plugin, reason) end if plugin.cond ~= nil then - if plugin.cond == false or (type(plugin.cond) == "function" and not plugin.cond()) then + local force = reason.cmd and reason.cmd:sub(-1) == "!" + if not force and (plugin.cond == false or (type(plugin.cond) == "function" and not plugin.cond())) then plugin._.cond = false return end diff --git a/lua/lazy/view/commands.lua b/lua/lazy/view/commands.lua index 39bd3f8..e47e384 100644 --- a/lua/lazy/view/commands.lua +++ b/lua/lazy/view/commands.lua @@ -52,6 +52,9 @@ M.commands = { load = function(opts) require("lazy.core.loader").load(opts.plugins, { cmd = "LazyLoad" }) end, + ["load!"] = function(opts) + require("lazy.core.loader").load(opts.plugins, { cmd = "LazyLoad!" }) + end, log = Manage.log, build = Manage.build, clean = Manage.clean,