mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-07 14:55:59 +01:00
feat: separate tabnine module and configuration
This commit is contained in:
parent
3694a84646
commit
a2e724a962
3 changed files with 74 additions and 0 deletions
24
modules/assistant/tabnine/config.nix
Normal file
24
modules/assistant/tabnine/config.nix
Normal 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},
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/assistant/tabnine/default.nix
Normal file
6
modules/assistant/tabnine/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./config.nix
|
||||
./tabnine.nix
|
||||
]
|
||||
}
|
44
modules/assistant/tabnine/tabnine.nix
Normal file
44
modules/assistant/tabnine/tabnine.nix
Normal 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";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue