nix-community.nixvim/plugins/completion/cmp/cmp-helpers.nix
Matt Sturgeon 3a8d4fee35
plugins/cmp: refactor source->plugin association
Introduce the internal option `cmpSourcePlugins` where plugins can
register their nvim-cmp source name association.
2024-06-30 18:22:59 +01:00

28 lines
539 B
Nix

{
lib,
helpers,
config,
pkgs,
...
}:
with helpers.vim-plugin;
with lib;
{
mkCmpSourcePlugin =
{
name,
sourceName,
extraPlugins ? [ ],
useDefaultPackage ? true,
...
}:
mkVimPlugin config {
inherit name;
extraPlugins = extraPlugins ++ (lists.optional useDefaultPackage pkgs.vimPlugins.${name});
maintainers = [ maintainers.GaetanLepage ];
# Register the source -> plugin name association
imports = [ { cmpSourcePlugins.${sourceName} = name; } ];
};
}