{ lib, config, ... }: let inherit (lib) mkEnableOption mkIf; cfg = config.home.devtools.nixvim.plugins.copilot; in { options = { home.devtools.nixvim.plugins.copilot.enable = mkEnableOption "Enables AI tools for nixvim"; }; config = mkIf cfg.enable { programs.nixvim = { plugins = { copilot-chat = { enable = true; }; copilot-lua = { enable = true; suggestion = { enabled = false; autoTrigger = true; keymap.accept = ""; }; panel.enabled = false; }; }; keymaps = [ { action = "lua local input = vim.fn.input('Quick Chat: '); if input ~= '' then require('CopilotChat').ask(input, { selection = require('CopilotChat.select').buffer }) end"; key = "qc"; options = { desc = "CopilotChat - Quick chat"; }; mode = [ "n" ]; } { action = "CopilotChatToggle"; key = "ac"; options = { desc = "Toggle Coilot chat"; }; mode = [ "n" ]; } ]; }; }; }