最近基于 copilot.el 和 tabnine-capf 改了下 tabnine-capf 插件,现在体验感觉还不错,可以结合 overlay 和 capf 使用,欢迎大佬们体验 ~
以下是使用的大概配置,首先安装和配置 TabNine 插件,如下,如果需要配置帐号之类的可以执行 tabnine-configuration
命令打开 TabNine Hub 页面配置即可。
(use-package tabnine
:after (on)
:commands (tabnine-start-process)
:hook ((prog-mode vterm-mode) . tabnine-mode)
:straight (tabnine :package "tabnine"
:host github :repo "shuxiao9058/tabnine" )
:diminish "⌬"
:custom
(tabnine-wait 0.5)
(tabnine-minimum-prefix-length 0)
:init
(setq tabnine-executable-args (list "--log-level" "Error" "--no-lsp" "false"))
:hook ((on-first-input . tabnine-start-process)
(kill-emacs . tabnine-kill-process))
:config
(defun +tabnine-disable-predicate()
(or ;; (derived-mode-p 'vterm-mode)
(meow-motion-mode-p)
(meow-normal-mode-p)))
(add-to-list 'tabnine-disable-predicates #'+tabnine-disable-predicate)
:bind
(:map tabnine-mode-map
;; ("C-TAB" . tabnine-accept-completion-by-word)
;; ("C-<tab>" . tabnine-accept-completion-by-word)
("TAB" . tabnine-accept-completion)
("<tab>" . tabnine-accept-completion))
(:map tabnine-completion-map
("M-f" . tabnine-accept-completion-by-word)
("M-<return>" . tabnine-accept-completion-by-line)
("C-g" . tabnine-clear-overlay)
("M-[" . tabnine-previous-completion)
("M-]" . tabnine-next-completion)
;; ("C-n" . tabnine-next-completion)
;; ("C-p" . tabnine-previous-completion)
))
然后将 tabnine-completion-at-point 添加到 completion-at-point-functions
即可。
(add-to-list 'completion-at-point-functions #'tabnine-completion-at-point)
当然,我的配置链接:
截图简单示例:
overlay 展示补全代码:
corfu 展示补全代码: