Closed zhou13 closed 2 weeks ago
thanks for the idea...
one of the reasons is that the separated community.lua
is loaded before the plugins/
but feel free to import astrocommunity specs in plugins/
but it's possible you could run into trouble because of loading order
I am not sure if I understand your proposal. Even if I load AstroNvim/astrocommunity
under plugins
, can I organize the configuration along with each community plugin?
its your config :D you can do what you want. but just be aware, that there are reasons or issues that happened before why we recommended load the specs first and modify them later in plugins
I am not sure how this is related to moving lua/community.lua
under plugins
. I guess I did not express the problem clearly, so let me try again. Say that I have 3 community plugins, and I want to config each. My proposed solution is to add the support for extra_config
so that we can have lua/community.lua
like
return {
"AstroNvim/astrocommunity",
{
import = "astrocommunity.completion.cmp-cmdline"
extra_config = { { "foo/bar.nvim", opts = { <some-opts> }, },
},
{
import = "astrocommunity.completion.cmp-under-comparator"
extra_config = { { "foo/bar2.nvim", opts = { <some-opts> }, },
},
{
import = "astrocommunity.diagnostics.trouble-nvim"
extra_config = { { "foo/bar3.nvim", opts = { <some-opts> }, },
},
}
The benefit of writing the configuration this way is that when I delete or reorganize some of the community plugins, I will move the extra_config
along with them. It is more clear that the configuration is for that community plugins.
Are you saying that by moving lua/community.lua
to plugins
, I can achieve similar results?
https://github.com/AstroNvim/AstroNvim#minimal-confignviminitlua is the bare minimum you need to run astronvim as u can see there is no community.lua u can do what ever you want, but if you run into problems you have to fix them yourself
maybe u need some guideline how could you use community.lua
here is my config as a example:
what a lot people do(and i do too), is :
use the community.lua as intended and import the specs you want ,and modify them in a 1 file (or multiple, lazy.nvim doesn't care) in plugins (the default would be user.lua, but the name doesnt matter)
and if you still want quickly disable a plugin you can use enabled = false
per spec in the user.lua
alternatively if you would use optional = true
on every modification in user.lua, and you could simply comment out a line in community.lua
as well
A solution to what you ask @zhou13 is to just create a plugins/community.lua
file that contains all the configuration.
This is really a question regarding lazy.nvim. we don't control the flags there. Also architecturally the requested feature doesn't necessarily make sense semantically. The reason we recommend separating them is to guarantee that your configuration happens last. Many plugins in AstroCommunity may continue modifying plugin specs. So you have no idea if something will then come and overwrite what you want. You can definitely put your configuration next to where you do the import in your community.lua
file, but I would highly recommend against it because it can lead to potentially unexpected behavior.
Since this has no action items in AstroNvim or AstroCommunity I'll go ahead and close those. Thanks for the discussion though! Hopefully others with similar questions stumble across this :)
Is your feature related to a problem?
It is impossible to write configuration for a plugin directly in
lua/community.lua
. I need to create a new file inlua/plugin
. This is not very modular and difficult to track the relation between plugin configuration and community pack. For example, if I want to remove a particular community pack, it might be hard to remeber which file to remove underlua/plugin
.Describe the new feature
Allow to write configuration in lua/community.lua. For example,
Additional context
No response