summary refs log tree commit diff stats
path: root/user/emacs/init.el
diff options
context:
space:
mode:
authorAlan Pearce2024-12-10 19:10:29 +0100
committerAlan Pearce2024-12-10 19:34:32 +0100
commitc98dc89219bdd965b6fd3aeb31fd33335add2e3b (patch)
tree5ffae08f09f97a89663cbdd3055a33c391822b89 /user/emacs/init.el
parentf4406ad7fcaaaa342fdf425a2cda0e553388be02 (diff)
downloadnixfiles-c98dc89219bdd965b6fd3aeb31fd33335add2e3b.tar.lz
nixfiles-c98dc89219bdd965b6fd3aeb31fd33335add2e3b.tar.zst
nixfiles-c98dc89219bdd965b6fd3aeb31fd33335add2e3b.zip
Revert "remove tabnine and all related configuration"
This reverts commit 1065e1ba0fce3f7295ad6017b063f6324490aacd.
Diffstat (limited to 'user/emacs/init.el')
-rw-r--r--user/emacs/init.el23
1 files changed, 23 insertions, 0 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index 01f25b38..870032ae 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -608,6 +608,29 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
             (setq kind-icon-default-face 'corfu-default)
             (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter)))
 
+(use-package tabnine-core
+  :config (progn
+            (setq tabnine-binaries-folder "~/.local/tabnine")
+            (with-demoted-errors "TabNine error: %s"
+              (when (tabnine--executable-path)
+                (global-tabnine-mode)))
+
+            (define-key tabnine-completion-map (kbd "TAB") #'tabnine-accept-completion)
+            (define-key tabnine-completion-map (kbd "<tab>") #'tabnine-accept-completion)
+
+            (define-key tabnine-completion-map (kbd "M-f") #'tabnine-accept-completion-by-word)
+            (define-key tabnine-completion-map (kbd "M-<return>") #'tabnine-accept-completion-by-line)
+            (define-key tabnine-completion-map (kbd "C-e") #'tabnine-accept-completion-by-line)
+            (define-key tabnine-completion-map (kbd "<right>") #'tabnine-accept-completion-by-line)
+
+            (define-key tabnine-completion-map (kbd "C-g") #'tabnine-clear-overlay)
+            (define-key tabnine-completion-map (kbd "M-[") #'tabnine-next-completion)
+            (define-key tabnine-completion-map (kbd "M-]") #'tabnine-previous-completion))
+  :init (progn
+          (advice-add 'tabnine-start-process :around #'quiet)
+
+          (add-hook 'kill-emacs-hook #'tabnine-kill-process)))
+
 (use-package tempel
   :general ("M-+" #'tempel-complete ;; Alternative tempel-expand
             "M-*" #'tempel-insert