mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-25 17:19:47 +01:00
106 lines
2.8 KiB
Nix
106 lines
2.8 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
with lib;
|
|
with builtins; let
|
|
cfg = config.vim.assistant.copilot;
|
|
in {
|
|
options.vim.assistant.copilot = {
|
|
enable = mkEnableOption "GitHub Copilot AI assistant";
|
|
|
|
panel = {
|
|
position = mkOption {
|
|
type = types.enum [
|
|
"bottom"
|
|
"top"
|
|
"left"
|
|
"right"
|
|
];
|
|
default = "bottom";
|
|
description = "Panel position";
|
|
};
|
|
ratio = mkOption {
|
|
type = types.float;
|
|
default = 0.4;
|
|
description = "Panel size";
|
|
};
|
|
};
|
|
|
|
mappings = {
|
|
panel = {
|
|
jumpPrev = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = "[[";
|
|
description = "Jump to previous suggestion";
|
|
};
|
|
jumpNext = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = "]]";
|
|
description = "Jump to next suggestion";
|
|
};
|
|
accept = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = "<CR>";
|
|
description = "Accept suggestion";
|
|
};
|
|
refresh = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = "gr";
|
|
description = "Refresh suggestions";
|
|
};
|
|
open = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = "<M-CR>";
|
|
description = "Open suggestions";
|
|
};
|
|
};
|
|
suggestion = {
|
|
accept = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = "<M-l>";
|
|
description = "Accept suggetion";
|
|
};
|
|
acceptWord = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = null;
|
|
description = "Accept next word";
|
|
};
|
|
acceptLine = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = null;
|
|
description = "Accept next line";
|
|
};
|
|
prev = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = "<M-[>";
|
|
description = "Previous suggestion";
|
|
};
|
|
next = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = "<M-]>";
|
|
description = "Next suggestion";
|
|
};
|
|
dismiss = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = "<C-]>";
|
|
description = "Dismiss suggestion";
|
|
};
|
|
};
|
|
};
|
|
|
|
copilot_node_command = mkOption {
|
|
type = types.str;
|
|
default = "${lib.getExe cfg.copilotNodePackage}";
|
|
description = "Path to nodejs";
|
|
};
|
|
|
|
copilotNodePackage = mkOption {
|
|
type = with types; nullOr package; # TODO - maybe accept a path as well? imperative users might want to use something like nvm
|
|
default = pkgs.nodejs-slim; # this will likely need to be downgraded because Copilot does not stay up to date with NodeJS
|
|
description = "The package that will be used for Copilot. NodeJS v18 is recommended.";
|
|
};
|
|
};
|
|
}
|