summary refs log tree commit diff stats
path: root/user/emacs
diff options
context:
space:
mode:
authorAlan Pearce2023-09-16 16:37:35 +0200
committerAlan Pearce2023-09-16 16:37:35 +0200
commitb650fde62cdef9adb55db636ce16aa2120277d55 (patch)
tree715b441b4fa07e10bec00fdc63d3a30cde2a9c33 /user/emacs
parent7fd9609a559997142ecdb19a74546475344cca21 (diff)
downloadnixfiles-b650fde62cdef9adb55db636ce16aa2120277d55.tar.lz
nixfiles-b650fde62cdef9adb55db636ce16aa2120277d55.tar.zst
nixfiles-b650fde62cdef9adb55db636ce16aa2120277d55.zip
Emacs: replace company-tabnine with tabnine
Diffstat (limited to 'user/emacs')
-rw-r--r--user/emacs/init.el22
1 files changed, 18 insertions, 4 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index a90973c1..9317968a 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -558,12 +558,26 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
             (setq company-shell-clean-manpage t)
             (add-to-list 'company-backends '(company-shell company-shell-env))))
 
-(use-package company-tabnine
+(use-package tabnine
   :after (company)
-  :config (setq company-tabnine-binaries-folder "~/.local/tabnine")
+  :config (progn
+            (delq 'company-preview-if-just-one-frontend company-frontends)
+            (setq tabnine-binaries-folder "~/.local/tabnine")
+            (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-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 'company-tabnine-start-process :around #'quiet)
-          (add-to-list 'company-backends #'company-tabnine)))
+          (advice-add 'tabnine-start-process :around #'quiet)
+
+          (add-hook 'kill-emacs-hook #'tabnine-kill-process)))
 
 ;;; Documentation