Skip to content

Commit e7d3a63

Browse files
committed
feat(corfu): new completion system with hovering docs
Removes company mode as corfu has a better support for TUI.
1 parent 64898fe commit e7d3a63

1 file changed

Lines changed: 29 additions & 23 deletions

File tree

init.el

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -651,35 +651,41 @@
651651
:init (setq markdown-command "multimarkdown")) ;; Set the Markdown processing command.
652652

653653

654-
;;; COMPANY
655-
;; Company Mode provides a text completion framework for Emacs.
654+
;;; CORFU
655+
;; Corfu Mode provides a text completion framework for Emacs.
656656
;; It enhances the editing experience by offering context-aware
657-
;; suggestions as you type. With support for multiple backends,
658-
;; Company Mode is highly customizable and can be integrated with
657+
;; suggestions as you type.
658+
;; Corfu Mode is highly customizable and can be integrated with
659659
;; various modes and languages.
660-
(use-package company
661-
:defer t
662-
:straight t
660+
(use-package corfu
663661
:ensure t
662+
:straight t
663+
:defer t
664664
:custom
665-
(company-tooltip-align-annotations t) ;; Align annotations with completions.
666-
(company-minimum-prefix-length 1) ;; Trigger completion after typing 1 character
667-
(company-idle-delay 0.2) ;; Delay before showing completion (adjust as needed)
668-
(company-tooltip-maximum-width 50)
665+
(corfu-auto nil) ;; Only completes when hitting TAB
666+
;; (corfu-auto-delay 0) ;; Delay before popup (enable if corfu-auto is t)
667+
(corfu-auto-prefix 1) ;; Trigger completion after typing 1 character
668+
(corfu-quit-no-match t) ;; Quit popup if no match
669+
(corfu-scroll-margin 5) ;; Margin when scrolling completions
670+
(corfu-max-width 50) ;; Maximum width of completion popup
671+
(corfu-min-width 50) ;; Minimum width of completion popup
672+
(corfu-popupinfo-delay 0.5) ;; Delay before showing documentation popup
669673
:config
674+
(if ek-use-nerd-fonts
675+
(add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))
676+
:init
677+
(global-corfu-mode)
678+
(corfu-popupinfo-mode t))
670679

671-
;; While using C-p C-n to select a completion candidate
672-
;; C-y quickly shows help docs for the current candidate
673-
(define-key company-active-map (kbd "C-y")
674-
(lambda ()
675-
(interactive)
676-
(company-show-doc-buffer)))
677-
(define-key company-active-map [tab] 'company-complete-selection)
678-
(define-key company-active-map (kbd "TAB") 'company-complete-selection)
679-
(define-key company-active-map [ret] 'company-complete-selection)
680-
(define-key company-active-map (kbd "RET") 'company-complete-selection)
681-
:hook
682-
(after-init . global-company-mode)) ;; Enable Company Mode globally after initialization.
680+
681+
;;; NERD-ICONS-CORFU
682+
;; Provides Nerd Icons to be used with CORFU.
683+
(use-package nerd-icons-corfu
684+
:if ek-use-nerd-fonts
685+
:ensure t
686+
:straight t
687+
:defer t
688+
:after (:all corfu))
683689

684690

685691
;;; LSP

0 commit comments

Comments
 (0)