Change back to corfu (crash was GTK3 mem leak)

This commit is contained in:
2024-10-02 17:00:28 -07:00
parent ea8d6bfe57
commit a5672f9284
2 changed files with 70 additions and 105 deletions

74
init.el
View File

@ -522,9 +522,6 @@ visual states."
("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi)
("M-g r" . consult-imenu-multi)
;; these are so that you can still newline even if a completion popup is open
("C-RET" . newline)
("C-<return>" . newline)
:map help-map
("TAB". consult-info)
("C-m" . consult-man))
@ -543,42 +540,43 @@ visual states."
(use-package embark-consult
:hook (embark-collect-mode . consult-preview-at-point-mode))
;; company (in buffer auto-complete)
(use-package company
:defer nil
:bind (("M-TAB" . company-complete)
("M-<tab>" . company-complete)
("C-c f" . company-files)
([remap dabbrev-expand] . company-dabbrev)
:map prog-mode-map
([remap company-dabbrev] . company-dabbrev-code))
:hook ((company-search-mode . my/-company-search-mode-add-lighter)
(sh-mode . my/-company-setup-shell-mode))
;; corfu (autocomplete)
(use-package corfu
:bind (("M-<tab>" . completion-at-point)
:map corfu-map
("M-SPC" . corfu-insert-separator)
("M-m" . my/corfu-move-to-minibuffer))
:init
(defun my/corfu-move-to-minibuffer ()
(interactive)
(when completion-in-region--data
(let ((completion-extra-properties corfu--extra)
(completion-cycle-threshold completion-cycling))
(apply #'consult-completion-in-region completion-in-region--data))))
(setq corfu-cycle t
corfu-auto t
corfu-on-exact-match nil
completion-cycle-threshold nil)
(global-corfu-mode 1)
(corfu-popupinfo-mode 1)
:config
(defun my/-company-setup-shell-mode ()
(setq-local company-backends '(company-files company-keywords
company-dabbrev-code)))
(defun my/-company-search-mode-add-lighter ()
(if company-search-mode
(cl-pushnew company-search-lighter global-mode-string :test 'equal)
(setq global-mode-string
(cl-delete company-search-lighter global-mode-string :test 'equal))))
(defun my/-company-set-completion-styles (oldfun &rest args)
(let ((completion-styles '(basic emacs21 flex)))
(apply oldfun args)))
(advice-add 'company-capf :around 'my/-company-set-completion-styles)
(setopt company-format-margin-function #'company-text-icons-margin
company-require-match nil
company-tooltip-align-annotations t)
(setq company-transformers '(company-sort-by-occurrence))
(global-company-mode 1))
(use-package company-quickhelp
:bind (:map company-active-map
("M-h" . company-quickhelp-manual-begin))
:after company
:config
(company-quickhelp-mode 1)
(setopt company-quickhelp-delay nil))
(add-to-list 'corfu-continue-commands #'my/corfu-move-to-minibuffer))
(use-package corfu-terminal
:init
(corfu-terminal-mode 1))
;; cape (a bunch of capfs!)
(use-package cape
:bind (("C-c p" . cape-dabbrev)
([remap dabbrev-expand] . cape-dabbrev)
("C-c P" . cape-line)
("C-c f" . cape-file))
:hook (text-mode . my/-cape-setup-text-mode)
:init
(defun my/-cape-setup-text-mode ()
(setq-local completion-at-point-functions
'(cape-dict cape-dabbrev)
corfu-auto nil)))
;; xref
(use-package xref