feature: language options in seperate files
Did you check the docs?
- [x] I have read all the lazy.nvim docs
Is your feature request related to a problem? Please describe.
Wanted to store my language config in seperate lua files and saw that lazy vim does something similar:
return {
recommended = function()
return LazyVim.extras.wants({
ft = "rust",
root = { "Cargo.toml", "rust-project.json" },
})
end,
{
"Saecki/crates.nvim",
event = { "BufRead Cargo.toml" },
opts = { },
}
}
However the recommended and the LaztVim.extras.wants are not included lazy.vim
Describe the solution you'd like
Can this feature be moved to lazy.nvim?
Describe alternatives you've considered
I tried using ~/.config/nvim/after/ftplugin/{language}.lua as explained by TJ DeVries but this seems only for vim options, not for lazy plugins.
I have it working without the recommended property but i think im missing out on perf improvements, right?
Additional context
No response
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Bump
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Bump
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
bump
Hm... What is the feature? I have read the issue and I don't get why it is needed. I think more example or explanation are needed.
Are you trying to define file type-specific settings for each plugin?
Are you trying to define file type-specific settings for each plugin?
Thanks for the reply. Yes, i was trying to implemt someting similar to LazyVim. rust.lua only seems to be loaded when the the filetype is rust and there is a cargo.toml and a rust-project.json in the root of the current working directory: https://github.com/LazyVim/LazyVim/blob/25abbf546d564dc484cf903804661ba12de45507/lua/lazyvim/plugins/extras/lang/rust.lua#L12-L17
Can you tell me more about the specific plugin settings you're trying to achieve? It sounds like you might be misunderstanding LazyVim's "recommend" feature. It conditionally recommends plugin installations, which seems different from what you're describing.
Sure. I wanted to organize my language-specific plugins into separate files, similar to how LazyVim does it: https://github.com/LazyVim/LazyVim/tree/main/lua/lazyvim/plugins/extras/lang
Ideally, I only want these plugins to be loaded when necessary. For example, the https://github.com/LazyVim/LazyVim/tree/main/lua/lazyvim/plugins/extras/lang/go.lua file should only be loaded when the following conditions are met:
ft = { "go", "gomod", "gowork", "gotmpl" },
root = { "go.work", "go.mod" },
This is what LazyVim.extras.wants handles right?
If that's the case, how about separating your language-specific plugins into individual repositories for each language and loading them separately?
As for loading plugins based on files in the root directory, since there is no such feature, I think it would be best to request only that feature from lazy.nvim.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.