mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2025-01-09 16:39:51 +01:00
blink: basic keymap option
This commit is contained in:
parent
aa03de57fd
commit
110b6dbd18
1 changed files with 29 additions and 7 deletions
|
@ -1,16 +1,38 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption literalMD;
|
||||||
inherit (lib.types) listOf string;
|
inherit (lib.types) listOf str either oneOf attrsOf;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||||
in {
|
in {
|
||||||
options.vim.autocomplete.blink-cmp = {
|
options.vim.autocomplete.blink-cmp = {
|
||||||
enable = mkEnableOption "blink.cmp";
|
enable = mkEnableOption "blink.cmp";
|
||||||
setupOpts = mkPluginSetupOption "blink.cmp" {
|
setupOpts = mkPluginSetupOption "blink.cmp" {
|
||||||
sources = mkOption {
|
sources = {
|
||||||
type = listOf string;
|
default = mkOption {
|
||||||
description = "List of sources to enable for completion.";
|
type = listOf str;
|
||||||
|
description = "Default list of sources to enable for completion.";
|
||||||
default = ["lsp" "path" "snippets" "buffer"];
|
default = ["lsp" "path" "snippets" "buffer"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
keymap = mkOption {
|
||||||
|
type = attrsOf (oneOf [luaInline str (listOf (either str luaInline))]);
|
||||||
|
default = {};
|
||||||
|
description = "blink.cmp keymap";
|
||||||
|
example = literalMD ''
|
||||||
|
```nix
|
||||||
|
"<Up>" = ["select_prev" "fallback"];
|
||||||
|
"<C-n>" = [
|
||||||
|
(lib.generators.mkLuaInline ''''
|
||||||
|
function(cmp)
|
||||||
|
if some_condition then return end -- runs the next command
|
||||||
|
return true -- doesn't run the next command
|
||||||
|
end,
|
||||||
|
'''')
|
||||||
|
"select_next"
|
||||||
|
];
|
||||||
|
```
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue