fix(corfu): move binds to :config default
Bindings were moved to the `:config default` module and some keys were adjusted to match Company/other modules. Small formatting issues and some apparently inintended nestings were corrected as well.
This commit is contained in:
parent
79e9fb3119
commit
899cb2c549
4 changed files with 85 additions and 74 deletions
|
@ -37,17 +37,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)))
|
||||
|
||||
(map! :map corfu-mode-map
|
||||
:e "C-M-i" #'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! :unless (modulep! :editor evil)
|
||||
:map corfu-mode-map
|
||||
"C-M-i" #'completion-at-point)
|
||||
|
||||
(add-hook! corfu-mode
|
||||
(defun +corfu-mode-unbinds ()
|
||||
;; In `corfu-mode', unbind C-SPC from `global-map', so Emacs keeps searching.
|
||||
|
@ -67,32 +56,9 @@ major mode regardless of size.")
|
|||
(when (modulep! +icons)
|
||||
(add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))
|
||||
|
||||
(let ((cmds-del (cmds! (and (modulep! +tng)
|
||||
(> corfu--index -1)
|
||||
(eq corfu-preview-current 'insert))
|
||||
#'corfu-reset)))
|
||||
(map! :map corfu-map
|
||||
[return] #'corfu-insert
|
||||
"RET" #'corfu-insert
|
||||
(:when (modulep! +orderless)
|
||||
"<remap> <completion-at-point>" #'+corfu-smart-sep-toggle-escape)
|
||||
(:when (modulep! +tng)
|
||||
[tab] #'corfu-next
|
||||
[backtab] #'corfu-previous
|
||||
"TAB" #'corfu-next
|
||||
"S-TAB" #'corfu-previous
|
||||
[backspace] cmds-del
|
||||
"DEL" cmds-del)))
|
||||
|
||||
(when (modulep! +orderless)
|
||||
(after! orderless
|
||||
(setq orderless-component-separator #'orderless-escapable-split-on-space)))
|
||||
|
||||
(after! vertico
|
||||
(map! :map corfu-map
|
||||
"M-m" #'+corfu-move-to-minibuffer
|
||||
(:when (modulep! :editor evil)
|
||||
"M-J" #'+corfu-move-to-minibuffer))))
|
||||
(setq orderless-component-separator #'orderless-escapable-split-on-space))))
|
||||
|
||||
(use-package! cape
|
||||
:defer t
|
||||
|
@ -121,17 +87,6 @@ major mode regardless of size.")
|
|||
eshell-mode)
|
||||
(defun +corfu-add-cape-dabbrev-h ()
|
||||
(add-hook 'completion-at-point-functions #'cape-dabbrev 20 t)))))
|
||||
(when (modulep! +line)
|
||||
;; Set up `cape-line' options.
|
||||
(defun +cape-line-buffers ()
|
||||
(cl-loop for buf in (buffer-list)
|
||||
if (or (eq major-mode (buffer-local-value 'major-mode buf))
|
||||
(< (buffer-size buf) +corfu-buffer-scanning-size-limit))
|
||||
collect buf))
|
||||
(setq cape-line-buffer-function #'+cape-line-buffers)
|
||||
(add-hook! (text-mode comint-mode minibuffer-setup)
|
||||
(defun +corfu-add-cape-line-h ()
|
||||
(add-hook 'completion-at-point-functions #'cape-line 20 t))))
|
||||
;; Complete emojis :).
|
||||
(when (and (modulep! +emoji) (> emacs-major-version 28))
|
||||
(add-hook! (prog-mode conf-mode)
|
||||
|
@ -197,16 +152,4 @@ major mode regardless of size.")
|
|||
(use-package! corfu-popupinfo
|
||||
:hook ((corfu-mode . corfu-popupinfo-mode))
|
||||
:config
|
||||
(setq corfu-popupinfo-delay '(0.5 . 1.0))
|
||||
(map! :map corfu-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-h" #'corfu-popupinfo-toggle)
|
||||
(map! :when (modulep! :editor evil)
|
||||
:map corfu-popupinfo-map
|
||||
;; 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))
|
||||
(setq corfu-popupinfo-delay '(0.5 . 1.0)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue