feat: separate tabnine module and configuration

This commit is contained in:
NotAShelf 2023-02-27 17:05:53 +03:00
parent 3694a84646
commit a2e724a962
No known key found for this signature in database
GPG key ID: 5B5C8895F28445F1
3 changed files with 74 additions and 0 deletions

View file

@ -0,0 +1,24 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.assistant.tabnine;
in {
config = mkIf cfg.enable {
vim.startPlugins = ["tabnine-nvim"];
vim.luaConfigRC.tabnine-nvim = nvim.dag.entryAnywhere ''
require('tabnine').setup({
disable_auto_comment = ${boolToString cfg.disable_auto_comment},
accept_keymap = ${cfg.accept_keymap},
dismiss_keymap = ${cfg.dismiss_keymap},
debounce_ms = ${cfg.debounce_ms},
execlude_filetypes = ${cfg.execlude_filetypes},
})
'';
};
}

View file

@ -0,0 +1,6 @@
_: {
imports = [
./config.nix
./tabnine.nix
]
}

View file

@ -0,0 +1,44 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.assistant.tabnine;
in {
options.vim.assistant.tabnine = {
enable = mkEnableOption "Enable TabNine assistant";
disable_auto_comment = mkOption {
type = types.bool;
default = true;
description = "Disable auto comment";
};
accept_keymap = mkOption {
type = types.str;
default = "<Tab>";
description = "Accept keymap";
};
dismiss_keymap = mkOption {
type = types.str;
default = "<C-]>";
description = "Dismiss keymap";
};
debounce_ms = mkOption {
type = types.int;
default = 800;
description = "Debounce ms";
};
execlude_filetypes = mkOption {
type = types.listOf types.str;
default = ["TelescopePrompt" "NvimTree" "alpha"];
description = "Execlude filetypes";
};
};
}