minad / corfu

:desert_island: corfu.el - COmpletion in Region FUnction
GNU General Public License v3.0
1.06k stars 42 forks source link

Proposal: `corfu-top` and `corfu-bottom` #447

Closed mentalisttraceur closed 2 months ago

mentalisttraceur commented 2 months ago

I suggest these two helpers, to round out the options for moving around in the Corfu pop-up:

(defun corfu-top ()
    ;; Go to the top visible candidate.
    (interactive)
    (corfu--goto corfu--scroll))

(defun corfu-bottom ()
    ;; Go to the bottom visible candidate.
    (interactive)
    (corfu--goto (+ corfu--scroll (1- corfu-count))))

There's no strong need for these, but currently this can only be done by relying on Corfu's private functions/variables.

I wanted this because when I'm in a Corfu pop-up, I intuitively expect my keybinds for evil-window-top and evil-window-bottom to work as if the Corfu pop-up is a mini window.

inb4: not the same as corfu-first/corfu-last, those move over all candidates, these proposed functions only move within currently displayed candidates.