14 DEC 2022 from elken repo.

This commit is contained in:
Zachary Billman 2022-12-14 12:16:14 -05:00
parent 6ef402364f
commit 3359e5d76c

View File

@ -13,12 +13,20 @@
(tab-always-indent 'complete) (tab-always-indent 'complete)
(corfu-min-width 80) (corfu-min-width 80)
(corfu-max-width corfu-min-width) (corfu-max-width corfu-min-width)
(corfu-preselect-first nil)
:hook :hook
(doom-first-buffer . global-corfu-mode) (doom-first-buffer . global-corfu-mode)
:config :config
(when (modulep! +minibuffer) (when (modulep! +minibuffer)
(add-hook 'minibuffer-setup-hook #'+corfu--enable-in-minibuffer)) (add-hook 'minibuffer-setup-hook #'+corfu--enable-in-minibuffer))
;; Dirty hack to get c completion running
;; Discussion in https://github.com/minad/corfu/issues/34
(when (and (modulep! :lang cc)
(equal tab-always-indent 'complete))
(map! :map c-mode-base-map
:i [remap c-indent-line-or-region] #'completion-at-point))
;; Reset lsp-completion provider ;; Reset lsp-completion provider
(add-hook 'doom-init-modules-hook (add-hook 'doom-init-modules-hook
(lambda () (lambda ()
@ -30,13 +38,22 @@
(lambda () (lambda ()
(setf (alist-get 'lsp-capf completion-category-defaults) '((styles . (orderless flex)))))) (setf (alist-get 'lsp-capf completion-category-defaults) '((styles . (orderless flex))))))
(defun corfu-move-to-minibuffer ()
"Move current completions to the minibuffer"
(interactive)
(let ((completion-extra-properties corfu--extra)
completion-cycle-threshold completion-cycling)
(apply #'consult-completion-in-region completion-in-region--data)))
(map! :map corfu-map (map! :map corfu-map
"C-SPC" #'corfu-insert-separator "C-SPC" #'corfu-insert-separator
"C-n" #'corfu-next "C-n" #'corfu-next
"C-p" #'corfu-previous "C-p" #'corfu-previous
"M-m" #'corfu-move-to-minibuffer
(:prefix "C-x" (:prefix "C-x"
"C-k" #'cape-dict "C-k" #'cape-dict
"C-f" #'cape-file)) "C-f" #'cape-file))
(after! evil (after! evil
(advice-add 'corfu--setup :after 'evil-normalize-keymaps) (advice-add 'corfu--setup :after 'evil-normalize-keymaps)
(advice-add 'corfu--teardown :after 'evil-normalize-keymaps) (advice-add 'corfu--teardown :after 'evil-normalize-keymaps)
@ -135,6 +152,20 @@
("C-q" . corfu-quick-insert))) ("C-q" . corfu-quick-insert)))
(use-package! corfu-echo
:after corfu
:hook (corfu-mode . corfu-echo-mode))
(use-package! corfu-info
:after corfu)
(use-package! corfu-popupinfo
:after corfu
:hook (corfu-mode . corfu-popupinfo-mode))
(use-package! evil-collection-corfu (use-package! evil-collection-corfu
:when (modulep! :editor evil +everywhere) :when (modulep! :editor evil +everywhere)
:defer t :defer t