2023-11-07 00:50:27 +00:00
|
|
|
{lib, ...}: let
|
2024-03-24 00:14:39 +00:00
|
|
|
inherit (lib.options) mkEnableOption mkOption literalMD;
|
2024-02-26 05:05:23 +00:00
|
|
|
inherit (lib.nvim.binds) mkMappingOption;
|
|
|
|
inherit (lib.types) enum attrsOf nullOr str;
|
2023-11-07 00:50:27 +00:00
|
|
|
in {
|
2023-02-27 14:52:43 +00:00
|
|
|
options.vim = {
|
|
|
|
autocomplete = {
|
2023-06-05 20:10:25 +00:00
|
|
|
enable = mkEnableOption "enable autocomplete" // {default = false;};
|
2023-02-27 14:52:43 +00:00
|
|
|
|
2023-04-22 15:43:58 +00:00
|
|
|
mappings = {
|
|
|
|
complete = mkMappingOption "Complete [nvim-cmp]" "<C-Space>";
|
|
|
|
confirm = mkMappingOption "Confirm [nvim-cmp]" "<CR>";
|
|
|
|
next = mkMappingOption "Next item [nvim-cmp]" "<Tab>";
|
|
|
|
previous = mkMappingOption "Previous item [nvim-cmp]" "<S-Tab>";
|
|
|
|
close = mkMappingOption "Close [nvim-cmp]" "<C-e>";
|
|
|
|
scrollDocsUp = mkMappingOption "Scroll docs up [nvim-cmp]" "<C-d>";
|
|
|
|
scrollDocsDown = mkMappingOption "Scroll docs down [nvim-cmp]" "<C-f>";
|
|
|
|
};
|
|
|
|
|
2023-02-27 14:52:43 +00:00
|
|
|
type = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = enum ["nvim-cmp"];
|
2023-02-27 14:52:43 +00:00
|
|
|
default = "nvim-cmp";
|
|
|
|
description = "Set the autocomplete plugin. Options: [nvim-cmp]";
|
|
|
|
};
|
2023-04-17 20:27:27 +00:00
|
|
|
|
|
|
|
sources = mkOption {
|
2023-11-04 11:30:04 +00:00
|
|
|
description = ''
|
2023-04-17 22:48:44 +00:00
|
|
|
Attribute set of source names for nvim-cmp.
|
|
|
|
|
|
|
|
If an attribute set is provided, then the menu value of
|
|
|
|
`vim_item` in the format will be set to the value (if
|
|
|
|
utilizing the `nvim_cmp_menu_map` function).
|
|
|
|
|
|
|
|
Note: only use a single attribute name per attribute set
|
|
|
|
'';
|
2024-02-26 05:05:23 +00:00
|
|
|
type = attrsOf (nullOr str);
|
2023-04-17 22:48:44 +00:00
|
|
|
default = {};
|
|
|
|
example = ''
|
|
|
|
{nvim-cmp = null; buffer = "[Buffer]";}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
formatting = {
|
|
|
|
format = mkOption {
|
2023-11-04 11:30:04 +00:00
|
|
|
description = ''
|
2023-04-17 22:48:44 +00:00
|
|
|
The function used to customize the appearance of the completion menu.
|
|
|
|
|
2023-11-06 00:46:51 +00:00
|
|
|
If [](#opt-vim.lsp.lspkind.enable) is true, then the function
|
2023-04-17 22:48:44 +00:00
|
|
|
will be called before modifications from lspkind.
|
|
|
|
|
|
|
|
Default is to call the menu mapping function.
|
|
|
|
'';
|
2024-02-26 05:05:23 +00:00
|
|
|
type = str;
|
2023-04-17 22:48:44 +00:00
|
|
|
default = "nvim_cmp_menu_map";
|
2024-03-24 00:14:39 +00:00
|
|
|
example = literalMD ''
|
2023-11-04 11:30:04 +00:00
|
|
|
```lua
|
2023-04-17 22:48:44 +00:00
|
|
|
function(entry, vim_item)
|
|
|
|
return vim_item
|
|
|
|
end
|
2023-11-04 11:30:04 +00:00
|
|
|
```
|
2023-04-17 22:48:44 +00:00
|
|
|
'';
|
|
|
|
};
|
2023-04-17 20:27:27 +00:00
|
|
|
};
|
2023-02-27 14:52:43 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|