nixvim-config/config/plugins/utils/codecompanion.nix
♥ Minnie ♥ a42a45bdc1
feat: update ollama settings and add general, display, and strategies options for CodeCompanion
- Added configuration for the ollama adapter in the settings.
- Configured general options including log level, send code, default actions, and prompts.
- Defined display options with action palette prompt, provider, and opts.
- Updated strategies to use the ollama adapter.
- Modified keymaps to include a toggle chat command without specifying an action for now.
2025-02-17 23:57:58 +08:00

79 lines
1.8 KiB
Nix

{...}: {
plugins.codecompanion = {
enable = true;
# Settings configuration
settings = {
# Adapter settings for ollama
adapters = {
ollama = {
__raw = ''
function()
return require('codecompanion.adapters').extend('ollama', {
env = {
url = "http://127.0.0.1:11434",
},
schema = {
model = { default = 'deepseek-coder-v2:latest' },
num_ctx = { default = 4096, },
num_predict = { default = -1, },
},
})
end
'';
};
};
# General options for CodeCompanion
opts = {
log_level = "TRACE";
send_code = true;
use_default_actions = true;
use_default_prompts = true;
};
# Display options
display = {
action_palette = {
prompt = "Prompt ";
provider = "telescope";
opts = {
show_default_actions = true;
show_default_prompt_library = true;
};
};
};
# strategies configuration
strategies = {
agent = {adapter = "ollama";};
chat = {adapter = "ollama";};
inline = {adapter = "ollama";};
};
};
};
# Keymaps for CodeCompanion
keymaps = [
{
mode = ["n" "v"];
key = "<leader>tc";
action = "<cmd>CodeCompanionChat<cr>";
options = {
silent = true;
desc = "Toggle CodeCompanion Chat";
};
}
{
mode = ["n" "v"];
key = "<leader>ta";
action = "<cmd>CodeCompanionActions<cr>";
options = {
silent = true;
desc = "Toggle CodeCompanion Actions";
};
}
];
}