summary refs log tree commit diff stats
path: root/user
diff options
context:
space:
mode:
authorAlan Pearce2023-04-17 09:23:15 +0200
committerAlan Pearce2023-04-17 09:23:15 +0200
commitd3779759662e190b9ce7ccbd4620b956984e2b07 (patch)
tree2a3301e975298f9f77df693273aa6690940ac5ae /user
parent83ff6d74036e287497bf987f336ca800b101ed0b (diff)
downloadnixfiles-d3779759662e190b9ce7ccbd4620b956984e2b07.tar.lz
nixfiles-d3779759662e190b9ce7ccbd4620b956984e2b07.tar.zst
nixfiles-d3779759662e190b9ce7ccbd4620b956984e2b07.zip
TabNine: move basic editor setup to tabnine module
Diffstat (limited to 'user')
-rw-r--r--user/modules/tabnine.nix17
-rw-r--r--user/settings/emacs.nix5
-rw-r--r--user/settings/neovim.nix4
-rw-r--r--user/settings/tabnine.nix6
4 files changed, 18 insertions, 14 deletions
diff --git a/user/modules/tabnine.nix b/user/modules/tabnine.nix
index 7e38e0ec..e4b80ad9 100644
--- a/user/modules/tabnine.nix
+++ b/user/modules/tabnine.nix
@@ -72,5 +72,22 @@ in
     home.file."${cfg.configDir}/registration_key" = {
       text = cfg.registrationKey;
     };
+
+    programs.neovim.plugins = [
+      pkgs.vimPlugins.coc-tabnine
+    ];
+    programs.neovim.coc.settings = {
+      "tabnine.binary_path" = "${pkgs.tabnine}/bin/TabNine";
+    };
+
+    programs.emacs.extraPackages = epkgs: [
+      epkgs.company-tabnine
+    ];
+    programs.emacs.extraConfig = ''
+      (with-eval-after-load 'company-tabnine
+        (advice-add 'company-tabnine--executable-path :around
+          (lambda (original-function &rest args)
+            "${pkgs.tabnine}/bin/TabNine")))
+    '';
   };
 }
diff --git a/user/settings/emacs.nix b/user/settings/emacs.nix
index fd6037cb..3c1e98e7 100644
--- a/user/settings/emacs.nix
+++ b/user/settings/emacs.nix
@@ -87,7 +87,6 @@ in
         company
         company-posframe
         company-shell
-        company-tabnine
         consult
         consult-eglot
         counsel
@@ -162,10 +161,6 @@ in
     extraConfig = ''
       (with-eval-after-load 'editorconfig
         (setq editorconfig-exec-path "${pkgs.editorconfig-core-c}/bin/editorconfig"))
-      (with-eval-after-load 'company-tabnine
-        (advice-add 'company-tabnine--executable-path :around
-          (lambda (original-function &rest args)
-            "${pkgs.tabnine}/bin/TabNine")))
     '' + lib.optionalString stdenv.isDarwin ''
       (with-eval-after-load 'files
         (setq insert-directory-program "${pkgs.coreutils-prefixed}/bin/gls"))
diff --git a/user/settings/neovim.nix b/user/settings/neovim.nix
index 4fd58b11..87398783 100644
--- a/user/settings/neovim.nix
+++ b/user/settings/neovim.nix
@@ -12,7 +12,6 @@
       commentary
       coc-git
       coc-json
-      coc-tabnine
       coc-yaml
       direnv-vim
       vim-surround
@@ -25,9 +24,6 @@
         "suggest.enablePreview" = true;
         "coc.preferences.formatOnSaveFiletypes" = [ "nix" ];
         "nil.formatting.command" = "nixpkgs-fmt";
-        tabnine = {
-          binary_path = "${pkgs.tabnine}/bin/TabNine";
-        };
         semantictokens = {
           filetypes = [ "nix" ];
         };
diff --git a/user/settings/tabnine.nix b/user/settings/tabnine.nix
index 4b812cb6..103db849 100644
--- a/user/settings/tabnine.nix
+++ b/user/settings/tabnine.nix
@@ -7,7 +7,7 @@
     tabnine
   ];
   programs.tabnine = {
-    enable = true;
+    enable = pkgs.lib.mkDefault true;
     config = {
       version = pkgs.tabnine.version;
 
@@ -85,8 +85,4 @@
       };
     };
   };
-
-  programs.neovim.coc.settings = {
-    "tabnine.binary_path" = "${pkgs.tabnine}/bin/TabNine";
-  };
 }