-
-
Notifications
You must be signed in to change notification settings - Fork 361
modules/performance: add an option to combine plugins to a single plugin pack #1886
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
Changes from all commits
3258347
388c522
e50320c
9129c9b
77ee33a
ad21cef
4792e62
8e8932a
d2a1e63
9a8f196
f8c7b7c
fa30bc6
435713d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |
| ./lua-loader.nix | ||
| ./opts.nix | ||
| ./output.nix | ||
| ./performance.nix | ||
| ./plugins.nix | ||
| ]; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| { lib, ... }: | ||
| let | ||
| inherit (lib) types; | ||
| in | ||
| { | ||
| options.performance = { | ||
| combinePlugins = { | ||
| enable = lib.mkEnableOption "combinePlugins" // { | ||
| description = '' | ||
| Whether to enable EXPERIMENTAL option to combine all plugins | ||
| into a single plugin pack. It can significantly reduce startup time, | ||
| but all your plugins must have unique filenames and doc tags. | ||
| Any collision will result in a build failure. To avoid collisions | ||
| you can add your plugin to the `standalonePlugins` option. | ||
| Only standard neovim runtime directories are linked to the combined plugin. | ||
| If some of your plugins contain important files outside of standard | ||
| directories, add these paths to `pathsToLink` option. | ||
| ''; | ||
| }; | ||
| pathsToLink = lib.mkOption { | ||
| type = with types; listOf str; | ||
| default = [ ]; | ||
| example = [ "/data" ]; | ||
| description = "List of paths to link into a combined plugin pack."; | ||
| }; | ||
| standalonePlugins = lib.mkOption { | ||
| type = with types; listOf (either str package); | ||
| default = [ ]; | ||
| example = [ "nvim-treesitter" ]; | ||
| description = "List of plugins (names or packages) to exclude from plugin pack."; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| config.performance = { | ||
| # Set option value with default priority so that values are appended by default | ||
| combinePlugins.pathsToLink = [ | ||
| # :h rtp | ||
| "/autoload" | ||
| "/colors" | ||
| "/compiler" | ||
| "/doc" | ||
| "/ftplugin" | ||
| "/indent" | ||
| "/keymap" | ||
| "/lang" | ||
| "/lua" | ||
| "/pack" | ||
| "/parser" | ||
| "/plugin" | ||
| "/queries" | ||
| "/rplugin" | ||
| "/spell" | ||
| "/syntax" | ||
| "/tutor" | ||
| "/after" | ||
| # ftdetect | ||
| "/ftdetect" | ||
| # plenary.nvim | ||
| "/data/plenary/filetypes" | ||
| ]; | ||
| }; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,6 +112,9 @@ helpers.neovim-plugin.mkNeovimPlugin config { | |
| require('telescope').load_extension(extension) | ||
| end | ||
| ''; | ||
|
|
||
| # planets picker requires files in data/memes/planets | ||
| performance.combinePlugins.pathsToLink = [ "/data/memes/planets" ]; | ||
|
Comment on lines
+116
to
+117
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having to define this explicitly feels fragile... What would happen if we add another plugin module but don't notice we need to define addition paths to link?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Additional paths will be missing from user runtime if I think in a description of this options should be clear, that this option is experimental, doesn't give any guaranties etc. So if it works for user's config, he'll get a performance boost, if not — sorry. I've added EXPERIMENTAL to the description for that purpose. But English is not native for me, if you have better description, we can update it.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the description is good. I think we can support this feature with less guarantees on breaking changes, i.e we won't add tests for all the plugins trying to enable the option, as this might be a too large maintenance burden, but we'll gladly include workarounds if people suggest them |
||
| }; | ||
|
|
||
| settingsOptions = { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.