TAB-only completion
By default, Corfu steals both the RET and TAB keys, when the Corfu popup is open. This can feel intrusive, in particular in combination with auto completion. RET may accidentally commit an automatically selected candidate, while you actually wanted to start a new line. As an alternative we can unbind the RET key completely from corfu-map or reserve the RET key only in shell modes using a menu-item filter.
emacs-lisp
;; TAB-only configuration
(use-package corfu
:custom
(corfu-auto t) ;; Enable auto completion
(corfu-preselect 'directory) ;; Select the first candidate, except for directories
:init
(global-corfu-mode)
:config
;; Free the RET key for less intrusive behavior.
;; Option 1: Unbind RET completely
;; (keymap-unset corfu-map "RET")
;; Option 2: Use RET only in shell modes
(keymap-set corfu-map "RET" `( menu-item "" nil :filter
,(lambda (&optional _)
(and (derived-mode-p 'eshell-mode 'comint-mode)
#'corfu-send)))))