aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md62
1 files changed, 62 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..1ad2ca6
--- /dev/null
+++ b/README.md
@@ -0,0 +1,62 @@
+# lazy-like-loader.nvim
+Lazy-like-loader is a plugin-loading plugin utilizing the builtin `vim.pack`
+package manager, but incorporating a module-per-plugin loading paradigm like
+[lazy.nvim](https://lazy.folke.io/) (see the way lazy does it
+[here](https://lazy.folke.io/usage/structuring)).
+
+Lazy-like-loader uses similar (not identical) idiomatic "plugin spec"
+conventions to [lazy's plugin spec](https://lazy.folke.io/spec), making it
+convenient for those moving from lazy to `vim.pack` or other plugin management
+solutions (e.g. adding plugins via a separate package manager like Nix).
+
+The loader can also be used to hierarchical loading via the `dependents` and
+`dependencies` options in the plugin spec, and arbitrary functions can be setup
+to run after loading via `loadFn`.
+
+The entire loader is hyper-minimal at only ~70 lines of lua.
+
+## Usage
+Install the plugin using `vim.pack` (or another package manager if you'd like),
+then initialize it like so:
+
+```lua
+require("lazy-like-loader").setup {
+ package = "tjk.plugins",
+}
+```
+
+The `package` option is required. It will point to the package containing all
+your plugin modules. In this case: `~/.config/nvim/lua/tjk/plugins` (or
+wherever your nvim home is).
+
+
+Plugin modules can then be defined using the `plugin spec`, for example:
+
+```lua
+-- autoclose.lua
+return {
+ "autoclose",
+ "https://github.com/m4xshen/autoclose.nvim",
+ setup = {
+ options = { pair_spaces = true },
+ },
+}
+```
+
+If the plugin cannot be loaded, then `source` will be passed to `vim.pack.add`
+by default which will prompt the user to optionally install the plugin.
+This behavior can be disabled by setting `packAddMissing = false` in `setup`.
+
+More examples can be found as part of my [neovim config here](https://git.tjkeller.xyz/nvim/tree/lua/tjk/plugins)
+
+## Plugin spec
+
+| Property | Type | Description |
+|-------------------|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| [1] or moduleName | `string` | plugin name loaded via `require(moduleName)` |
+| [2] or source | `string?` | plugin source, added via `vim.pack.add { source }` |
+| dependencies | `plugin[]?` | table of plugins loaded before the initial plugin. same spec is used recursively |
+| dependents | `plugin[]?` | table of plugins loaded after the initial plugin. same spec is used recursively |
+| enabled | `boolean?` | whether to attempt to initialize the plugin the loader |
+| loadFn | `fun()?` | runs after plugin and dependencies are successfully loaded, but before dependents |
+| setup | `table` or `boolean?` | table passed to setup function. if unset or `false` then setup will not be ran. if `true` then opts is set to `{}`. otherwise opts is set to the value of `setup` |