Add corfu autocompletion

This commit is contained in:
Mark van der Putten 2024-07-17 00:49:42 +02:00
parent f7babdeff5
commit 36a4a9c122
2 changed files with 55 additions and 0 deletions

53
elisp/init-completion.el Normal file
View File

@ -0,0 +1,53 @@
;;; init-completion.el --- -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
(use-package corfu
;; Optional customizations
;; :custom
;; (corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
;; (corfu-auto t) ;; Enable auto completion
;; (corfu-separator ?\s) ;; Orderless field separator
;; (corfu-quit-at-boundary nil) ;; Never quit at completion boundary
;; (corfu-quit-no-match nil) ;; Never quit, even if there is no match
;; (corfu-preview-current nil) ;; Disable current candidate preview
;; (corfu-preselect 'prompt) ;; Preselect the prompt
;; (corfu-on-exact-match nil) ;; Configure handling of exact matches
;; (corfu-scroll-margin 5) ;; Use scroll margin
;; Enable Corfu only for certain modes.
;; :hook ((prog-mode . corfu-mode)
;; (shell-mode . corfu-mode)
;; (eshell-mode . corfu-mode))
;; Recommended: Enable Corfu globally. This is recommended since Dabbrev can
;; be used globally (M-/). See also the customization variable
;; `global-corfu-modes' to exclude certain modes.
:config
(global-corfu-mode 1))
;; (use-package corfu
;; ;;:ensure (:files (:defaults "extensions/*"))
;; :demand t ; need this when using :bind or :hook
;; :config
;; (global-corfu-mode 1)
;; :custom
;; (corfu-auto t)
;; (corfu-auto-delay 0.5)
;; (corfu-quit-no-match t) ; quit when the popup appears and I type anything else
;; ;; Might want to customize corfu-sort-function
;; ;; :bind
;; ;; (("M-RET" . completion-at-point)
;; ;; )
;; )
;; Nice icons for corfu popups
(use-package kind-icon
:after corfu
:config
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
(provide 'init-completion)

View File

@ -127,6 +127,8 @@ If you experience freezing, decrease this. If you experience stuttering, increa
(require 'init-syntax) (require 'init-syntax)
(require 'init-parens) (require 'init-parens)
(require 'init-completion)
;;; (require 'init-indent) ;;; (require 'init-indent)
;;; (require 'init-quickrun) ;;; (require 'init-quickrun)