2023-02-27 14:05:43 +00:00
|
|
|
{
|
|
|
|
config,
|
2024-02-26 05:05:23 +00:00
|
|
|
pkgs,
|
2023-02-27 14:05:43 +00:00
|
|
|
lib,
|
|
|
|
...
|
2023-11-07 00:50:27 +00:00
|
|
|
}: let
|
2024-02-26 05:05:23 +00:00
|
|
|
inherit (lib.options) mkEnableOption mkOption;
|
|
|
|
inherit (lib.types) enum float nullOr str package;
|
|
|
|
inherit (lib.meta) getExe;
|
2023-11-07 00:50:27 +00:00
|
|
|
|
2023-05-10 09:11:33 +00:00
|
|
|
cfg = config.vim.assistant.copilot;
|
|
|
|
in {
|
2023-02-27 14:05:43 +00:00
|
|
|
options.vim.assistant.copilot = {
|
2023-06-05 20:10:25 +00:00
|
|
|
enable = mkEnableOption "GitHub Copilot AI assistant";
|
2023-07-24 13:51:24 +00:00
|
|
|
cmp.enable = mkEnableOption "nvim-cmp integration for GitHub Copilot";
|
2023-02-27 14:05:43 +00:00
|
|
|
|
2023-04-11 12:38:27 +00:00
|
|
|
panel = {
|
|
|
|
position = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = enum [
|
2023-04-11 12:38:27 +00:00
|
|
|
"bottom"
|
|
|
|
"top"
|
|
|
|
"left"
|
|
|
|
"right"
|
|
|
|
];
|
|
|
|
default = "bottom";
|
|
|
|
description = "Panel position";
|
|
|
|
};
|
|
|
|
ratio = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = float;
|
2023-04-11 12:38:27 +00:00
|
|
|
default = 0.4;
|
|
|
|
description = "Panel size";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
mappings = {
|
|
|
|
panel = {
|
|
|
|
jumpPrev = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "[[";
|
|
|
|
description = "Jump to previous suggestion";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
jumpNext = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "]]";
|
|
|
|
description = "Jump to next suggestion";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
accept = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "<CR>";
|
|
|
|
description = "Accept suggestion";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
refresh = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "gr";
|
|
|
|
description = "Refresh suggestions";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
open = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "<M-CR>";
|
|
|
|
description = "Open suggestions";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
suggestion = {
|
|
|
|
accept = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "<M-l>";
|
|
|
|
description = "Accept suggetion";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
acceptWord = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = null;
|
|
|
|
description = "Accept next word";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
acceptLine = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = null;
|
|
|
|
description = "Accept next line";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
prev = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "<M-[>";
|
|
|
|
description = "Previous suggestion";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
next = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "<M-]>";
|
|
|
|
description = "Next suggestion";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
dismiss = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "<C-]>";
|
|
|
|
description = "Dismiss suggestion";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-07-24 13:51:24 +00:00
|
|
|
copilotNodeCommand = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = str;
|
|
|
|
default = "${getExe cfg.copilotNodePackage}";
|
2023-07-24 13:51:24 +00:00
|
|
|
description = ''
|
|
|
|
The command that will be executed to initiate nodejs for GitHub Copilot.
|
|
|
|
Recommended to leave as default.
|
|
|
|
'';
|
2023-02-27 14:05:43 +00:00
|
|
|
};
|
2023-05-10 09:11:33 +00:00
|
|
|
|
|
|
|
copilotNodePackage = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr package;
|
2023-07-24 13:51:24 +00:00
|
|
|
default = pkgs.nodejs-slim;
|
|
|
|
description = ''
|
|
|
|
The nodeJS package that will be used for GitHub Copilot. If you are using a custom node command
|
|
|
|
you may want to set this option to null so that the package is not pulled from nixpkgs.
|
|
|
|
'';
|
2023-05-10 09:11:33 +00:00
|
|
|
};
|
2023-02-27 14:05:43 +00:00
|
|
|
};
|
|
|
|
}
|