-
-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plugins/lazy.nvim: Import Statements & Adding user-specified packages to lazyPath
#1904
plugins/lazy.nvim: Import Statements & Adding user-specified packages to lazyPath
#1904
Conversation
I think the underlying issue here is that the plugin type isn't freeform, so users can only use the option interface we've declared. I'll review this later (unless someone else in @nix-community/nixvim beats me to it) but I think when we have time the implementation should be refactored to comply with rfc42. |
Oooh I had no idea what rfc42, and freeform was until I looked into it more after your comment. Pretty cool stuff! I think I might be able to refactor at least the lazy plugin manager to comply with rfc42 when I've got time. I have some local test changes that make it so that the {
plugins = {
lazy = {
enable = true;
setup = {
rtp = {
disabled_plugins = [
"gzip"
"tarplugin"
"tohtml"
"tutor"
"zipplugin"
];
};
};
};
};
} would lead to this lua code without having to explicitly define the require("lazy").setup({
performance = {
rtp = {
disabled_plugins = {
"gzip",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
}) Just need to do something similar for lazy plugins |
You could reference the #1874 (lz-n) PR that has had the same issue. Though it isn't important to get this all done in one single PR, once reviewed this could be merged and then another PR could refactor the |
1844d04
to
07dd285
Compare
So it's been a while since I could get back to this but I've created another PR that adds a freeform setup option, and makes the existing |
- Adds support for `import` statements to import additional plugin modules in any given spec. - For multiple import modules, additional specs for each import are automatically created.
… in the `lazyPath` - The `packages` attribute in the scope of `plugins.lazy.plugins` now allows user-specified packages to be made avalable in the `lazyPath`. - When using `import` statements to import additional plugin modules, those imported plugin modules might require certain plugins/packages to be available in the `lazyPath`. For example importing the plugin module `lazyvim.plugins` when using LazyVim necessitates this feature.
07dd285
to
622041b
Compare
This is better handled by #2082 |
When using the lazy nvim plugin manager I couldn't find any way to add
import
statements to import additional plugin modules in any given spec without having to resort to just using lua inextraConfigLua
(See: Importing Specs,config
&opts
).This PR adds 2 features:
lazyPath
Import Statements
Importing a single plugin module
A single plugin module can be imported like this
The lua equivalent for this would look something like this:
Importing multiple plugin modules
The lua equivalent for this would look something like this:
Allow user-specified packages to be made available in the
lazyPath
Some plugin modules will look for packages/plugins in the
lazyPath
. This was an issue I encountered when trying to set up LazyVim with nixvim. Adding nix packages to thelazyPath
can be done now from any plugin spec.Single package to add to
lazyPath
example:Multiple packages to be added to
lazyPath
example:Aside Example: Setting up LazyVim with this PR's changes
Just as an aside I thought it might help or be cool to see how LazyVim can be setup using these changes as a practical example.
flake.nix