diff --git a/modules/assistant/tabnine/config.nix b/modules/assistant/tabnine/config.nix new file mode 100644 index 0000000..8b10bcf --- /dev/null +++ b/modules/assistant/tabnine/config.nix @@ -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}, + }) + ''; + }; +} diff --git a/modules/assistant/tabnine/default.nix b/modules/assistant/tabnine/default.nix new file mode 100644 index 0000000..8e1722e --- /dev/null +++ b/modules/assistant/tabnine/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./config.nix + ./tabnine.nix + ] +} \ No newline at end of file diff --git a/modules/assistant/tabnine/tabnine.nix b/modules/assistant/tabnine/tabnine.nix new file mode 100644 index 0000000..785e392 --- /dev/null +++ b/modules/assistant/tabnine/tabnine.nix @@ -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 = ""; + description = "Accept keymap"; + }; + + dismiss_keymap = mkOption { + type = types.str; + default = ""; + 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"; + }; + }; +}