#+title: Completion #+author: Evie Litherland-Smith #+email: evie@xenia.me.uk #+filetags: :emacs:config:org: #+property: header-args:emacs-lisp :tangle yes :mkdirp yes :results output silent * Vertico #+begin_src emacs-lisp (use-package vertico :ensure t :diminish :custom (vertico-cycle t) :init (vertico-mode) :config (require 'vertico-directory)) #+end_src * Marginalia #+begin_src emacs-lisp (use-package marginalia :ensure t :diminish :custom (marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil)) :config (marginalia-mode +1)) #+end_src * Orderless #+begin_src emacs-lisp (use-package orderless :ensure t :diminish :custom (completion-styles '(orderless basic)) (completion-category-defaults nil) (completion-category-overrides '((file (styles . (partial-completion)))))) #+end_src * Corfu and Cape #+begin_src emacs-lisp (use-package corfu :ensure t :diminish :demand :custom (corfu-cycle t) (corfu-auto t) (corfu-auto-delay 0.2) (corfu-auto-prefix 2) (corfu-quit-no-match 'separator) (corfu-quit-at-boundary 'separator) (corfu-preview-current nil) (corfu-preselect 'directory) :bind ( :map corfu-map ("M-SPC" . corfu-insert-separator) ("RET" . nil) ("TAB" . corfu-insert) ([tab] . corfu-insert)) :init (global-corfu-mode +1) (corfu-history-mode +1) :config (when (require 'corfu-popupinfo nil :noerror) (setq corfu-popupinfo-delay 0.3) (corfu-popupinfo-mode +1) (keymap-set corfu-map "M-p" #'corfu-popupinfo-scroll-down) (keymap-set corfu-map "M-n" #'corfu-popupinfo-scroll-up) (keymap-set corfu-map "M-d" #'corfu-popupinfo-toggle)) (defun corfu-enable-always-in-minibuffer () "Enable Corfu in the minibuffer if Vertico is not active." (unless (or (bound-and-true-p vertico--input) (eq (current-local-map) read-passwd-map)) (setq-local corfu-echo-delay nil ;; Disable automatic echo and popup corfu-auto nil ;; Enable/disable auto completion corfu-popupinfo-delay nil) (corfu-mode +1))) (add-hook 'minibuffer-setup-hook #'corfu-enable-always-in-minibuffer 1) (defun my/local-corfu-no-auto () (setq-local corfu-auto nil)) (with-eval-after-load 'eshell (add-hook 'eshell-mode-hook 'my/local-corfu-no-auto)) (with-eval-after-load 'shell (add-hook 'shell-mode-hook 'my/local-corfu-no-auto)) (with-eval-after-load 'gud (add-hook 'gud-mode-hook 'my/local-corfu-no-auto))) (require 'corfu) (use-package cape :ensure t :diminish :demand :init (add-to-list 'completion-at-point-functions #'cape-emoji) (add-to-list 'completion-at-point-functions #'cape-file) (add-to-list 'completion-at-point-functions #'cape-dabbrev) :custom (cape-dabbrev-min-length (+ corfu-auto-prefix 1))) (require 'cape) #+end_src * Consult #+begin_src emacs-lisp (use-package consult :ensure t :diminish :bind ((" " . consult-imenu) (" " . consult-buffer) (" " . consult-project-buffer) (" " . consult-org-heading) ("C-c s l" . consult-line) ("C-c s o" . consult-outline) ("C-c s f" . consult-fd) ("C-c s g" . consult-ripgrep) ("C-c s e" . consult-flymake) ("C-c s i" . consult-info) :map minibuffer-local-map ("C-r" . consult-history)) :config (setq completion-in-region-function #'consult-completion-in-region)) (use-package consult-eglot :ensure t :diminish :after (consult eglot) :bind (("C-c s s" . consult-eglot-symbols))) (use-package consult-yasnippet :ensure t :diminish :after (consult yasnippet) :bind (("C-c s y" . consult-yasnippet))) #+end_src * Embark #+begin_src emacs-lisp (use-package embark :ensure t :diminish :bind ((" " . embark-bindings) ("C-." . embark-act)) :config (setq prefix-help-command #'embark-prefix-help-command)) (use-package embark-consult :ensure t :diminish :after (embark consult) :hook (embark-collect-mode . consult-preview-at-point-mode)) #+end_src