feat(corfu): update smart tab completion

This commit updates the smart tab functionality so that:
1. The only functionality checked is for the modules that are enabled.
2. The priority of the TAB behavior is tunable by the user.

This also updates the TAB behavior for the Corfu module to be
`indent-for-tab-command` instead of `completion-at-point` so that users
can use the TAB key to indent their code and navigating Org tables.

We also address #7372 by checking overriding-terminal-local-map, as that
is used by Embark.
This commit is contained in:
StrawberryTea 2024-03-20 18:02:27 -05:00
parent 73f19acb66
commit 41f37ca31b
5 changed files with 140 additions and 59 deletions

View file

@ -202,6 +202,15 @@ A few variables may be set to change behavior of this module:
- [[var:+corfu-want-minibuffer-completion]] ::
Whether to enable Corfu in the minibuffer. See its documentation for
additional tweaks.
- [[var:+corfu-want-tab-prefer-expand-snippets]] ::
Whether to prefer expanding snippets over cycling candidates when pressing
[[kbd:][TAB]].
- [[var:+corfu-want-tab-prefer-navigating-snippets]] ::
Whether to prefer navigating snippets over cycling candidates when pressing
[[kbd:][TAB]] and [[kbd:][S-TAB]].
- [[var:+corfu-want-tab-prefer-navigating-org-tables]] ::
Whether to prefer navigating org tables over cycling candidates when pressing
[[kbd:][TAB]] and [[kbd:][S-TAB]].
** Adding CAPFs to a mode
To add other CAPFs on a mode-per-mode basis, put either of the following in your

View file

@ -16,6 +16,18 @@ Possible values are:
Setting this to `aggressive' will enable Corfu in more commands which
use the minibuffer such as `query-replace'.")
(defvar +corfu-want-tab-prefer-expand-snippets nil
"If non-nil, prefer expanding snippets over cycling candidates with
TAB.")
(defvar +corfu-want-tab-prefer-navigating-snippets nil
"If non-nil, prefer navigating snippets over cycling candidates with
TAB/S-TAB.")
(defvar +corfu-want-tab-prefer-navigating-org-tables nil
"If non-nil, prefer navigating org tables over cycling candidates with
TAB/S-TAB.")
;;
;;; Packages
(use-package! corfu