refactor(corfu): settings and keybinding overhaul

Previously, a distinction was made only between "regular" style (assumed
to be for people who prefer to cycle directionally and commit with RET)
and +tng (assumed to be for people who prefer TAB and auto-commit). This
made composing further variations harder on the user, as they would have
to work around our bindings. Now we have many features as documentation,
and the user can compose to their liking. The global CAPF list was
pruned, suggesting to use individual keys for those functions if
required.
This commit is contained in:
Luigi Sartor Piucco 2024-03-02 13:10:00 -03:00
parent 3aa1ea74d9
commit 9e7967c909
No known key found for this signature in database
GPG key ID: 6FF1A01853A47A66
7 changed files with 177 additions and 241 deletions

View file

@ -1,13 +1,5 @@
;;; 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 ()
"Move the current list of candidates to your choice of minibuffer completion UI."
@ -46,21 +38,4 @@
(save-excursion (backward-char 1)
(insert-char ?\\)))
(t
;; Without this corfu quits immediately.
(setq this-command #'corfu-insert-separator)
(call-interactively #'corfu-insert-separator))))
;;;###autoload
(defun +corfu-in-doc-or-comment-p (_sym)
"Return non-nil if point is in a docstring or comment."
(or (nth 4 (syntax-ppss))
(when-let ((faces '(font-lock-comment-face
font-lock-doc-face
tree-sitter-hl-face:doc
tree-sitter-hl-face:comment))
(fs (get-text-property (point) 'face)))
(if (listp fs)
(cl-loop for f in fs
if (memq f faces)
return t)
(memq fs faces)))))