feat(corfu): new completion system with hovering docs

Removes company mode as corfu has a better support for TUI.
This commit is contained in:
Rahul Martim Juliato
2025-07-16 19:04:51 -03:00
committed by Rahul M. Juliato
parent 64898fe246
commit e7d3a63f9a

52
init.el
View File

@@ -651,35 +651,41 @@
:init (setq markdown-command "multimarkdown")) ;; Set the Markdown processing command. :init (setq markdown-command "multimarkdown")) ;; Set the Markdown processing command.
;;; COMPANY ;;; CORFU
;; Company Mode provides a text completion framework for Emacs. ;; Corfu Mode provides a text completion framework for Emacs.
;; It enhances the editing experience by offering context-aware ;; It enhances the editing experience by offering context-aware
;; suggestions as you type. With support for multiple backends, ;; suggestions as you type.
;; Company Mode is highly customizable and can be integrated with ;; Corfu Mode is highly customizable and can be integrated with
;; various modes and languages. ;; various modes and languages.
(use-package company (use-package corfu
:defer t
:straight t
:ensure t :ensure t
:straight t
:defer t
:custom :custom
(company-tooltip-align-annotations t) ;; Align annotations with completions. (corfu-auto nil) ;; Only completes when hitting TAB
(company-minimum-prefix-length 1) ;; Trigger completion after typing 1 character ;; (corfu-auto-delay 0) ;; Delay before popup (enable if corfu-auto is t)
(company-idle-delay 0.2) ;; Delay before showing completion (adjust as needed) (corfu-auto-prefix 1) ;; Trigger completion after typing 1 character
(company-tooltip-maximum-width 50) (corfu-quit-no-match t) ;; Quit popup if no match
(corfu-scroll-margin 5) ;; Margin when scrolling completions
(corfu-max-width 50) ;; Maximum width of completion popup
(corfu-min-width 50) ;; Minimum width of completion popup
(corfu-popupinfo-delay 0.5) ;; Delay before showing documentation popup
:config :config
(if ek-use-nerd-fonts
(add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))
:init
(global-corfu-mode)
(corfu-popupinfo-mode t))
;; While using C-p C-n to select a completion candidate
;; C-y quickly shows help docs for the current candidate ;;; NERD-ICONS-CORFU
(define-key company-active-map (kbd "C-y") ;; Provides Nerd Icons to be used with CORFU.
(lambda () (use-package nerd-icons-corfu
(interactive) :if ek-use-nerd-fonts
(company-show-doc-buffer))) :ensure t
(define-key company-active-map [tab] 'company-complete-selection) :straight t
(define-key company-active-map (kbd "TAB") 'company-complete-selection) :defer t
(define-key company-active-map [ret] 'company-complete-selection) :after (:all corfu))
(define-key company-active-map (kbd "RET") 'company-complete-selection)
:hook
(after-init . global-company-mode)) ;; Enable Company Mode globally after initialization.
;;; LSP ;;; LSP