dev: merging latest changes from pr7002

This commit is contained in:
Matt Nish-Lapidus 2023-12-27 10:21:11 -05:00
commit 07b6b399ce
4 changed files with 19 additions and 15 deletions

View file

@ -89,6 +89,8 @@ is visible, the following relevant keys are available:
| [[kbd:][M-m]] | Export to minibuffer (if [[doom-module::completion vertico]]) |
| [[kbd:][M-j]] | (evil) Export to minibuffer (if [[doom-module::completion vertico]]) |
| [[kbd:][RET]] | Insert candidate |
| [[kbd:][C-RET]] | (in minibuffer) Finish minibuffer without inserting candidate |
| [[kbd:][S-RET]] | (in minibuffer) Finish minibuffer after inserting candidate |
| [[kbd:][SPC]] | Quit autocompletion after a wildcard or pass-through |
| [[kbd:][C-SPC]] | Complete (unless [[doom-module::completion corfu +tng]]) |
| [[kbd:][C-SPC]] | (when completing) Insert separator DWIM (see below) |
@ -141,9 +143,8 @@ A few variables may be set to change behavior of this module:
recommended to leave it at that. Otherwise, single matches on snippet keys
expand immediately.
- [[var:+corfu-buffer-scanning-size-limit]] ::
Sets the maximum buffer size to be scanned by ~cape-dabbrev~ and
~cape-lines~. Defaults to 1 MB. Set this if you are having performance
problems using either CAPF.
Sets the maximum buffer size to be scanned by ~cape-dabbrev~. Defaults to 1
MB. Set this if you are having performance problems using the CAPF.
** Adding CAPFs to a mode
To add other CAPFs on a mode-per-mode basis, put either of the following in your

View file

@ -1,5 +1,13 @@
;;; completion/corfu/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +corfu-complete-and-exit-minibuffer ()
(interactive)
(if (>= corfu--index 0)
(corfu-complete)
(corfu-insert))
(exit-minibuffer))
;;;###autoload
(defun +corfu-move-to-minibuffer ()
;; Taken from corfu's README.

View file

@ -1,10 +1,7 @@
;;; completion/corfu/config.el -*- lexical-binding: t; -*-
(defvar +corfu-buffer-scanning-size-limit (* 1 1024 1024) ; 1 MB
"Size limit for a buffer to be scanned by `cape-line' or `cape-dabbrev'.
As an exception, `cape-line' will also scan buffers with the same
major mode regardless of size.")
"Size limit for a buffer to be scanned by `cape-dabbrev'.")
;;
;;; Packages
@ -37,12 +34,6 @@ major mode regardless of size.")
tab-always-indent (if (modulep! +tng) 'complete tab-always-indent))
(add-to-list 'completion-category-overrides `(lsp-capf (styles ,@completion-styles)))
(add-hook! corfu-mode
(defun +corfu-mode-unbinds ()
;; In `corfu-mode', unbind C-SPC from `global-map', so Emacs keeps searching.
(make-local-variable 'global-map)
(unbind-key "C-SPC" 'global-map)))
(add-hook! 'minibuffer-setup-hook
(defun +corfu-enable-in-minibuffer ()
"Enable Corfu in the minibuffer if `completion-at-point' is bound."

View file

@ -475,8 +475,12 @@ Continues comments if executed from a commented line. Consults
"C-S-p" #'corfu-popupinfo-scroll-down
"C-S-n" #'corfu-popupinfo-scroll-up
"C-S-u" (cmd! (funcall-interactively #'corfu-popupinfo-scroll-down corfu-popupinfo-min-height))
"C-S-d" (cmd! (funcall-interactively #'corfu-popupinfo-scroll-up corfu-popupinfo-min-height))))
"C-S-d" (cmd! (funcall-interactively #'corfu-popupinfo-scroll-up corfu-popupinfo-min-height)))
(:map corfu-map
:gi "C-<return>" '(menu-item "Conclude the minibuffer" exit-minibuffer
:enable (active-minibuffer-window))
:gi "S-<return>" '(menu-item "Insert completion and conclude" +corfu-complete-and-exit-minibuffer
:enable (active-minibuffer-window))))
(when-let ((cmds-del (and (modulep! :completion corfu +tng)
(cmds! (and (> corfu--index -1)
(eq corfu-preview-current 'insert))