Files
.emacs.d/lisp/init-completion.el
2026-03-15 12:56:10 +08:00

51 lines
1.2 KiB
EmacsLisp

;;; init-completion.el
;;; -*- lexical-binding: t -*-
;; eglot
(use-package eglot
:hook ((python-mode . eglot-ensure))
:config
(setq eglot-send-changes-idle-time 0.5))
;; corfu
(use-package corfu
:custom
(corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
:init
(global-corfu-mode)
(corfu-history-mode)
(corfu-popupinfo-mode)
(corfu-echo-mode)
:custom
(corfu-popupinfo-delay 0.5)
(corfu-auto t)
:bind
(:map corfu-map
("RET" . nil)))
(use-package emacs
:custom
(tab-always-indent 'complete)
;; Emacs 30 and newer: Disable Ispell completion function.
;; Try `cape-dict' as an alternative.
(text-mode-ispell-word-completion nil)
;; Hide commands in M-x which do not apply to the current mode. Corfu
;; commands are hidden, since they are not used via M-x. This setting is
;; useful beyond Corfu.
(read-extended-command-predicate #'command-completion-default-include-p))
;; cape
(use-package cape
:init
(add-to-list 'completion-at-point-functions #'cape-file) ;; 文件补全
(setq-local completion-at-point-functions
(list (cape-capf-super #'cape-dabbrev)))) ;; 启用dabbrev
(provide 'init-completion)