Corfu provides completion in region functions. This will create pop ups with completion options in the buffer.
(use-package corfu
:straight (:files (:defaults "extensions/*.el"))
:init
(global-corfu-mode)
(corfu-popupinfo-mode)
:bind
(:map corfu-map
("TAB" . corfu-next)
([tab] . corfu-next)
("S-TAB" . corfu-previous)
([backtab] . corfu-previous))
:custom
(corfu-auto t)
(corfu-cycle t)
(corfu-preselect 'prompt)
:config
<<corfu_config>>
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent)
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify))
Having the “RET” key bound for Corfu becomes very frustrating when trying to enter a newline when the completion window pops up. Unbinding “RET” and using the Tab-and-Go method is preferrable in order to not have to always add an extra space at the end of every line.
(keymap-set corfu-map "RET" `( menu-item "" nil :filter
,(lambda (&optional _)
(and (derived-mode-p 'eshell-mode 'comint-mode)
#'corfu-send))))
Set tab-always-indent
variable must be set to complete
. This will cause pressing <TAB>
once to indent, and twice will cause it to activate completion.
(tab-always-indent 'complete)
Tell Emacs what package this file provides.
(provide 'freemacs-corfu)