nvf/modules/plugins/assistant/codecompanion/config.nix
alv-around 0a6cd48f8b assistant/codecompanion-nvim: fix lazy load with blink-cmp
Enabling codecompanion and blink-cmp, would not install codecompanion.
The quick fix was to disable lazy loading all together. This is no
longer required
2026-03-02 10:28:51 +01:00

65 lines
1.7 KiB
Nix

{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.assistant.codecompanion-nvim;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = [
"plenary-nvim"
];
lazy.plugins = {
codecompanion-nvim = {
package = "codecompanion-nvim";
setupModule = "codecompanion";
inherit (cfg) setupOpts;
# Register commands with lz.n so Neovim recognizes them immediately
cmd = [
"CodeCompanion"
"CodeCompanionChat"
"CodeCompanionActions"
"CodeCompanionCmd"
];
# Ensure the plugin loads when entering Insert/Cmdline mode
# so the module is ready when blink.cmp requests it
event = ["InsertEnter" "CmdlineEnter"];
};
};
treesitter = {
enable = true;
# Codecompanion depends on the YAML grammar being added. Below is
# an easy way of adding an user-configurable grammar package exposed
# by the YAML language module *without* enabling the whole YAML language
# module. The package is defined even when the module is disabled.
grammars = [
config.vim.languages.yaml.treesitter.package
];
};
autocomplete = {
nvim-cmp = {
sources = {codecompanion-nvim = "[codecompanion]";};
sourcePlugins = ["codecompanion-nvim"];
};
blink-cmp = {
setupOpts.sources = {
default = ["codecompanion"];
providers.codecompanion = {
name = "CodeCompanion";
module = "codecompanion.providers.completion.blink";
};
};
};
};
};
};
}