Can't use defaults with mini.nvim modules
Most of the mini.nvim modules already have pretty good default. But the defaults are not applied due to the default setupOpts, which is {}. This results in the mini modules being loaded with require(MINI_MODULE).setup({}) instead of require(MINI_MODULE).setup().
I can't set setupOpts to null or "", as it is defined as anything.
How do I use these modules with the default values without having to copy and paste the default config for each module into my nvf configuration?
What do you think about introducing a setting like useDefaultSettings @NotAShelf ?
If something like this is ok for you, I can create a PR for all the mini modules. But I think it would make sense to have a more generic approach to this in the future.
pluginRC.mini-surround = entryAnywhere (
if cfg.useDefaultSettings then
''
require("mini.surround").setup()
''
else
''
require("mini.surround").setup(${toLuaObject cfg.setupOpts})
''
);
I don't use any of the mini modules, and I'm also not the one who added them. While I will note that I'm not a huge fan of duplicating lines with if else expressions, I'd like to hear what @LilleAila thinks as the author of Mini suite and @horriblename as the one behind toLuaObject.
I don't use any of the mini modules, and I'm also not the one who added them. While I will note that I'm not a huge fan of duplicating lines with
if elseexpressions, I'd like to hear what @LilleAila thinks as the author of Mini suite and @horriblename as the one behindtoLuaObject.
Just a suggestion, completely open to any other solution, as long as we can get the require statement inserted without the empty {}. I am not that experienced in Nix.
I can just imagine that this could be a common issue, so maybe it make sense to have some generic handling of default values in nvf with some helpers, etc..
What would be your suggested workaround @NotAShelf to make it work with nvf until there has been additional clarification to the general approach? The modules are now a part of nvf, independent of who contributed them initially, so there should be at least a documented way of how to use them in their most basic form. The documentation is currently lacking any information about default settings, how they are handled, how they should be handled by contributors, etc.. For people just wanting to use nvf to use mini modules, this could be frustrating, as they are not working as intended and as they would behave in other plugin/nvim managers, where they just work when added.
What would be your suggested workaround
use vim.extraPlugins to add them "manually"
{
vim.extraPlugins.mini-ai = {
package = "mini-ai";
setup = "require('mini.ai').setup()";
};
}
haven't looked closely at the problem, but allowing null type in setupOpts should be possible. whether it's a good idea i don't yet know
What would be your suggested workaround
use
vim.extraPluginsto add them "manually"{ vim.extraPlugins.mini-ai = { package = "mini-ai"; setup = "require('mini.ai').setup()"; }; }
haven't looked closely at the problem, but allowing null type in setupOpts should be possible. whether it's a good idea i don't yet know
Thanks a lot, that's much better than my workaround. As the readme states that there is a big focus on documentation, I just think we should add this somewhere. Currently the documentation is mainly focused on contributors. I would like to contribute something to the docs to make them more helpful for users that stumble upon these type of problems, as there are currently no guides, tutorials, etc. available.
The manual has a section for helpful tips, which I was unsure about moving to a standalone page in the current (somewhat inaccessible/unreadable) documentation format. This is on my priority list,and will be remedied as soon as I finish my home-baked documentation generator that has been in development for a while.
I do not agree that the manual aims at contributors. On the contrary I think it offers a poorer contributor experience compared to end-users, but thank you for sharing your thoughts. Looks like we can strengthen the sections that supply "power users" with information.
About the module interface, please allow me a day or two think. I'm currently trying to secure a grant for my research, and nvf is (admittedly) a little behind on my schedule. What @horriblename suggested will work (and we should probably document it for those unaware) but I also think it is a fragile solution; we are looking to offfer a Nix-based wrapper, and pivoting users to setting up plugins themselves to deal with missing options is at best a hack. Not a bad solution, but something we should fix in the long term.
Thanks for the quick and extensive feedback @NotAShelf ! I am pretty new to Nix, but like the approach of nvf and how it tries to make configuring nvim the "nix-way" as easy as possible. I would be happy, if I could contribute to the docs, be it with additions, updates or clarifications.
Regarding the manual, it's maybe also because of the structure that I had that impression. In the main manual, there is not really anything about actually configuring nvf, it would probably be good to add the example config from the repo in the docs to have some kind of reference. What I mean is that the docs go from "Installation" to "Custom plugins" without normal configuration in between. The default config section is also just referring to the Nix and Max configs, but doesn't event link them to the GitHub file.
I am really looking forward to your efforts with the documentation and as I said, happy to contribute where it could help.
What I mean is that the docs go from "Installation" to "Custom plugins" without normal configuration in between.
The "natural" next step after installation should be configuring nvf
admittedly it's quite easy to miss since the installation section is quite long and you would have to backtrack to table of contents to find it - should be addressed in #827, where I added a note to point towards the configuring section on the end of each installation method
What I mean is that the docs go from "Installation" to "Custom plugins" without normal configuration in between.
The "natural" next step after installation should be configuring nvf
admittedly it's quite easy to miss since the installation section is quite long and you would have to backtrack to table of contents to find it - should be addressed in #827, where I added a note to point towards the configuring section on the end of each installation method
Hey, that's what I meant, the link that you sent is a direct link to the "Configuring nvf" section, where the first point is "Custom Neovim Package" and not "Basic configuration". What I meant is that naturally I would expect the first section in the configuring section being actual configuration for built-in things like enabling lsps, using modules that are provided with nvf and get a basic understanding of the structure and philosophy behind the config. Basically a small compact version of the appendix a bit more comprehensive than the example configuration in the installation section. Instead it's directly throwing you into the cold water with custom plugins, overrides, etc., without teaching the basics. Interested in what you think of that :)
that sounds like a good idea. I don't have a concrete idea of what to put in such a section yet, but perhaps an overview of most used top-level options would be a good start
I should check what other nvim distros put in their docs
unfortunately, I have a lot on my plate currently (as do NotAShelf), so I will have to revisit this some other day