From d3779759662e190b9ce7ccbd4620b956984e2b07 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 17 Apr 2023 09:23:15 +0200 Subject: TabNine: move basic editor setup to tabnine module --- user/modules/tabnine.nix | 17 +++++++++++++++++ user/settings/emacs.nix | 5 ----- user/settings/neovim.nix | 4 ---- user/settings/tabnine.nix | 6 +----- 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"; - }; } -- cgit 1.4.1