nix-community.nixvim/tests/test-sources/plugins/completion/cmp-all-sources.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

39 lines
1 KiB
Nix

{ pkgs, ... }:
{
all-sources = {
module =
{ config, ... }:
{
plugins = {
copilot-lua = {
enable = true;
panel.enabled = false;
suggestion.enabled = false;
};
cmp = {
enable = true;
settings.sources =
with pkgs.lib;
let
disabledSources = [
# We do not provide the required HF_API_KEY environment variable.
"cmp_ai"
] ++ optional (pkgs.stdenv.hostPlatform.system == "aarch64-linux") "cmp_tabnine";
in
pipe config.cmpSourcePlugins [
# All known source names
attrNames
# Filter out disabled sources
(filter (name: !(elem name disabledSources)))
# Convert names to source attributes
(map (name: {
inherit name;
}))
];
};
};
};
};
}