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 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:
parent
2bb5f29a01
commit
8015d3172d
6 changed files with 180 additions and 234 deletions
|
@ -537,13 +537,6 @@
|
|||
"C-p" #'company-search-repeat-backward
|
||||
"C-s" (cmd! (company-search-abort) (company-filter-candidates))))
|
||||
|
||||
(:when (modulep! :completion corfu)
|
||||
:after corfu
|
||||
(:map corfu-mode-map
|
||||
"C-M-i" #'completion-at-point)
|
||||
(:map corfu-popupinfo-map
|
||||
"C-S-h" #'corfu-popupinfo-toggle))
|
||||
|
||||
;;; ein notebooks
|
||||
(:after ein:notebook-multilang
|
||||
:map ein:notebook-multilang-mode-map
|
||||
|
|
|
@ -162,34 +162,32 @@
|
|||
(:when (modulep! :completion corfu)
|
||||
(:after corfu
|
||||
(:map corfu-mode-map
|
||||
:e "C-M-i" #'completion-at-point
|
||||
(:when +corfu-want-C-x-bindings
|
||||
(:prefix "C-x"
|
||||
:i "C-l" #'cape-line
|
||||
:i "C-k" #'cape-keyword
|
||||
:i "C-f" #'cape-file
|
||||
:i "s" #'cape-dict
|
||||
:i "C-s" #'yasnippet-capf
|
||||
:i "C-n" #'cape-dabbrev
|
||||
:i "C-p" #'cape-history))
|
||||
(:unless (modulep! :completion corfu +tng)
|
||||
:i "C-SPC" #'completion-at-point
|
||||
:n "C-SPC" (cmd! (call-interactively #'evil-insert-state)
|
||||
(call-interactively #'completion-at-point))
|
||||
:v "C-SPC" (cmd! (call-interactively #'evil-change)
|
||||
(call-interactively #'completion-at-point))))
|
||||
:i "C-SPC" #'completion-at-point
|
||||
:n "C-SPC" (cmd! (call-interactively #'evil-insert-state)
|
||||
(call-interactively #'completion-at-point))
|
||||
:v "C-SPC" (cmd! (call-interactively #'evil-change)
|
||||
(call-interactively #'completion-at-point)))
|
||||
(:map corfu-map
|
||||
"C-SPC" #'corfu-insert-separator
|
||||
"C-k" #'corfu-previous
|
||||
"C-j" #'corfu-next
|
||||
"C-u" (cmd! (let (corfu-cycle)
|
||||
(funcall-interactively #'corfu-next (- corfu-count))))
|
||||
"C-d" (cmd! (let (corfu-cycle)
|
||||
(funcall-interactively #'corfu-next corfu-count)))))
|
||||
(:after corfu-popupinfo
|
||||
:map corfu-popupinfo-map
|
||||
"C-h" #'corfu-popupinfo-toggle
|
||||
;; Reversed because popupinfo assumes opposite of what feels intuitive
|
||||
;; with evil.
|
||||
"C-S-k" #'corfu-popupinfo-scroll-down
|
||||
"C-S-j" #'corfu-popupinfo-scroll-up
|
||||
"C-h" #'corfu-popupinfo-toggle)))
|
||||
"C-S-k" #'corfu-popupinfo-scroll-down
|
||||
"C-S-j" #'corfu-popupinfo-scroll-up
|
||||
"C-<up>" #'corfu-popupinfo-scroll-down
|
||||
"C-<down>" #'corfu-popupinfo-scroll-up
|
||||
"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)))))
|
||||
|
||||
;;; :completion (separate)
|
||||
(map! (:when (modulep! :completion ivy)
|
||||
|
|
|
@ -465,51 +465,36 @@ Continues comments if executed from a commented line. Consults
|
|||
"C-p" #'corfu-previous
|
||||
"C-n" #'corfu-next
|
||||
(:when (modulep! :completion corfu +orderless)
|
||||
[remap completion-at-point] #'+corfu-smart-sep-toggle-escape)
|
||||
(:when (modulep! :completion corfu +tng)
|
||||
:gi [tab] #'corfu-next
|
||||
:gi "TAB" #'corfu-next
|
||||
:gi [backtab] #'corfu-previous
|
||||
:gi "S-TAB" #'corfu-previous))
|
||||
(:after corfu-popupinfo
|
||||
:map corfu-popupinfo-map
|
||||
"C-<up>" #'corfu-popupinfo-scroll-down
|
||||
"C-<down>" #'corfu-popupinfo-scroll-up
|
||||
"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)))
|
||||
(:when (not (modulep! :completion corfu +tng))
|
||||
(:map corfu-map
|
||||
"C-<return>" `(menu-item "Conclude the minibuffer" exit-minibuffer
|
||||
:filter ,(lambda (cmd) (when (minibufferp nil t) cmd)))
|
||||
"S-<return>" `(menu-item "Insert completion and conclude"
|
||||
+corfu-complete-and-exit-minibuffer
|
||||
:filter ,(lambda (cmd) (when (minibufferp nil t) cmd))))))
|
||||
(when-let ((cmds-del (and (modulep! :completion corfu +tng)
|
||||
`(menu-item "Reset completion" corfu-reset
|
||||
:filter ,(lambda (cmd)
|
||||
(when (and (>= corfu--index 0)
|
||||
(eq corfu-preview-current 'insert))
|
||||
cmd)))))
|
||||
(cmds-ret `(menu-item "Insert completion" corfu-insert
|
||||
:filter ,(lambda (cmd)
|
||||
(cond ((eq corfu--index -1)
|
||||
(corfu-quit))
|
||||
((and (modulep! :completion corfu +tng)
|
||||
(eq corfu-preview-current 'insert)
|
||||
(minibufferp nil t))
|
||||
(corfu-insert)
|
||||
nil)
|
||||
(t
|
||||
cmd))))))
|
||||
[remap corfu-insert-separator] #'+corfu-smart-sep-toggle-escape)))
|
||||
(when-let ((cmds-del
|
||||
`(menu-item "Reset completion" corfu-reset
|
||||
:filter ,(lambda (cmd)
|
||||
(interactive)
|
||||
(when (and (>= corfu--index 0)
|
||||
(eq corfu-preview-current 'insert))
|
||||
cmd))))
|
||||
(cmds-ret-pt
|
||||
`(menu-item "Insert completion or pass-through" corfu-insert
|
||||
:filter ,(lambda (cmd)
|
||||
(interactive)
|
||||
(if (>= corfu--index 0)
|
||||
cmd
|
||||
(corfu-quit))))))
|
||||
(map! :when (modulep! :completion corfu)
|
||||
:after corfu
|
||||
:map corfu-map
|
||||
[backspace] cmds-del
|
||||
"DEL" cmds-del
|
||||
:ig [return] cmds-ret
|
||||
:ig "RET" cmds-ret))
|
||||
(:when (modulep! :completion corfu +on-ret)
|
||||
:gi [return] #'corfu-insert
|
||||
:gi "RET" #'corfu-insert)
|
||||
(:when (modulep! :completion corfu +on-ret-pt)
|
||||
:gi [return] cmds-ret-pt
|
||||
:gi "RET" cmds-ret-pt)
|
||||
(:unless (or (modulep! :completion corfu +on-ret)
|
||||
(modulep! :completion corfu +on-ret-pt))
|
||||
:gi [return] nil
|
||||
:gi "RET" nil)))
|
||||
|
||||
;; Smarter C-a/C-e for both Emacs and Evil. C-a will jump to indentation.
|
||||
;; Pressing it again will send you to the true bol. Same goes for C-e, except
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue