feat: add `Sloth load` subcommand

The command allows you to load plugins
main
LeMarsu 2024-05-30 02:15:37 +02:00
parent edab526dd0
commit 75bca38fb1
2 changed files with 28 additions and 10 deletions

View File

@ -18,6 +18,7 @@ A [neovim] plugin and configuration management plugin, highly inspired by [lazy]
- [Using your own `init.lua`](#using-your-own-initlua)
- [`:Sloth` command](#sloth-command)
- [`list` subcommand](#list-subcommand)
- [`load` subcommand](#load-subcommand)
- [API](#api)
<!-- TOC -->
@ -45,6 +46,7 @@ A [neovim] plugin and configuration management plugin, highly inspired by [lazy]
- [ ] on event
- [ ] on keybinding
- [X] load plugins in order (via plugin `dependencies` property)
- [X] Have a `:Sloth` command to load or query your plugins
- [ ] Generate spell files on build (maybe)
## SemVer
@ -205,23 +207,29 @@ sloth_flake.setup {
#### `:Sloth` command
`sloth-flake` give a `Sloth` command that you can call to gather some
informations about your plugins.
informations about or load your plugins.
```vim
Sloth [command] [args...]
```
Usage: `Sloth [command] [args...]`
If no arguments are given, the `Sloth` command will call the `list` subcommand.
##### `list` subcommand
```vim
Sloth list [filter]
```
Summary: List plugins.
Usage: `Sloth list [filter]`
- `filter`: filter the list of plugins.
- `"all"`: list all declared plugins. Same as if no filter is given.
- `"loaded"`: list only loaded plugins.
- `"notloaded"`: list only not loaded plugins.
- `all`: list all declared plugins. Same as if no filter is given.
- `loaded`: list only loaded plugins.
- `notloaded`: list only not loaded plugins.
##### `load` subcommand
Summary: Load lazy plugins.
Usage: `Sloth load <plugin> [plugin [...]]`
- `plugin`: a plugin to load
#### API

View File

@ -221,6 +221,16 @@ local commands = {
print(string.format("- %s", dep))
end
end,
load = function(plugins)
if #plugins == 0 then
vim_error("You should at least give a plugin to load!")
return
end
for _, plugin in ipairs(plugins) do
M.load(plugin)
end
end
}
function sloth_cmd(param)