summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--config/init-completion.el92
1 files changed, 12 insertions, 80 deletions
diff --git a/config/init-completion.el b/config/init-completion.el
index 50e0562..e5ec83b 100644
--- a/config/init-completion.el
+++ b/config/init-completion.el
@@ -11,107 +11,40 @@
   :ensure t
   :commands (consult-ripgrep consult-buffer consult-imenu)
   :bind (("C-c m"   . consult-mode-command)
-	 ("M-g o"   . consult-org-heading)
 	 ("C-x b"   . consult-buffer)
 	 ("C-x r b" . consult-bookmark)
 	 ("C-x p b" . consult-project-buffer)
 	 ("C-c i"   . consult-imenu)
 	 ("M-g e"   . consult-compile-error)
-	 ("M-g g"   . consult-goto-line)
 	 ("M-g M-g" . consult-goto-line)
 	 ("M-g m"   . consult-mark)
 	 ("M-g k"   . consult-global-mark)))
 
 (use-package corfu
   :ensure t
-  :demand t
-  :bind (("M-/" . completion-at-point)
-	 :map corfu-map
-	 ("C-n"      . corfu-next)
-	 ("C-p"      . corfu-previous)
-	 ("<return>" . corfu-insert)
-	 ("M-d"      . corfu-info-documentation)
-	 ("M-l"      . corfu-info-location)
-	 ("M-."      . corfu-move-to-minibuffer))
   :custom
-  ;; Works with `indent-for-tab-command'. Make sure tab doesn't indent when you
-  ;; want to perform completion
-  (tab-always-indent 'complete)
-  (completion-cycle-threshold t)      ; Always show candidates in menu
-
   (corfu-auto t)
   (corfu-auto-prefix 2)
-  (corfu-auto-delay 0.25)
-
-  (corfu-min-width 80)
-  (corfu-max-width corfu-min-width)     ; Always have the same width
-  (corfu-cycle t)
-
-  ;; `nil' means to ignore `corfu-separator' behavior, that is, use the older
-  ;; `corfu-quit-at-boundary' = nil behavior. Set this to separator if using
-  ;; `corfu-auto' = `t' workflow (in that case, make sure you also set up
-  ;; `corfu-separator' and a keybind for `corfu-insert-separator', which my
-  ;; configuration already has pre-prepared). Necessary for manual corfu usage with
-  ;; orderless, otherwise first component is ignored, unless `corfu-separator'
-  ;; is inserted.
-  (corfu-quit-at-boundary nil)
-  (corfu-separator ?\s)            ; Use space
-  (corfu-quit-no-match 'separator) ; Don't quit if there is `corfu-separator' inserted
-  (corfu-preview-current 'insert)  ; Preview first candidate. Insert on input if only one
-  (corfu-preselect-first t)        ; Preselect first candidate?
-
-  ;; Other
-  (corfu-echo-documentation nil)        ; Already use corfu-popupinfo
-
-  :init
-  ;; see https://github.com/minad/corfu#completing-in-the-eshell-or-shell
-  (add-hook 'eshell-mode-hook
-            (lambda ()
-              (setq-local corfu-auto nil)
-              (corfu-mode)))
+  (corfu-preview-current nil)
+  (corfu-auto-delay 0.2)
+  (corfu-popupinfo-delay '(0.4 . 0.2))
   :config
-  (global-corfu-mode))
-
-(use-package corfu-popupinfo
-  :after corfu
-  :hook (corfu-mode . corfu-popupinfo-mode)
-  :bind (:map corfu-map
-              ("M-n" . corfu-popupinfo-scroll-up)
-              ("M-p" . corfu-popupinfo-scroll-down)
-              ([remap corfu-show-documentation] . corfu-popupinfo-toggle))
-  :custom
-  (corfu-popupinfo-delay 0.5)
-  (corfu-popupinfo-max-width 70)
-  (corfu-popupinfo-max-height 20)
-  ;; Also here to be extra-safe that this is set when `corfu-popupinfo' is
-  ;; loaded. I do not want documentation shown in both the echo area and in
-  ;; the `corfu-popupinfo' popup.
-  (corfu-echo-documentation nil))
+  (setq tab-always-indent 'complete)
+  :custom-face
+  (corfu-border ((t (:inherit region :background unspecified))))
+  :bind ("M-/" . completion-at-point)
+  :hook ((after-init . global-corfu-mode)
+         (global-corfu-mode . corfu-popupinfo-mode)))
 
 (use-package cape
   :demand t
   :ensure t
-  :bind (("C-c . p" . completion-at-point)
-	 ("C-c . h" . cape-history)
-	 ("C-c . f" . cape-file)
-	 ("C-c . a" . cape-abbrev)
-	 ("C-c . l" . cape-line)
-	 ("C-c . w" . cape-dict)
-	 ("C-c . r" . cape-rfc1345))
   :init
-  ;; Add `completion-at-point-functions', used by `completion-at-point'.
   (add-to-list 'completion-at-point-functions #'cape-file)
-  (add-to-list 'completion-at-point-functions #'cape-abbrev))
+  (advice-add 'eglot-completion-at-point :around #'cape-wrap-buster))
 
 (use-package marginalia
-  :ensure t
-  ;; Either bind `marginalia-cycle' globally or only in the minibuffer
-  :bind (:map minibuffer-local-map
-              ("M-A" . marginalia-cycle))
-  :init
-  ;; Must be in the :init section of use-package such that the mode gets
-  ;; enabled right away. Note that this forces loading the package.
-  (marginalia-mode))
+  :hook (after-init . marginalia-mode))
 
 (use-package orderless
   :demand t
@@ -122,8 +55,7 @@
 
 (use-package vertico
   :ensure t
-  :init
-  (vertico-mode))
+  :hook ((after-init . vertico-mode)))
 
 (provide 'init-completion)