From a2e724a962f0f3cf92eba4b360b02c095602e0f4 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 27 Feb 2023 17:05:53 +0300 Subject: [PATCH] feat: separate tabnine module and configuration --- modules/assistant/tabnine/config.nix | 24 +++++++++++++++ modules/assistant/tabnine/default.nix | 6 ++++ modules/assistant/tabnine/tabnine.nix | 44 +++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 modules/assistant/tabnine/config.nix create mode 100644 modules/assistant/tabnine/default.nix create mode 100644 modules/assistant/tabnine/tabnine.nix 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"; + }; + }; +}