From 318a5ebdbbc15e58495405f6bcb7c5cd9624f66a Mon Sep 17 00:00:00 2001
From: Raúl Benencia <id@rbenencia.name>
Date: Mon, 28 Oct 2024 20:58:23 -0700
Subject: emacs: add rul-completion to literate config

---
 .emacs.d/rul-lisp/packages/rul-completion.el | 48 +++++++---------------------
 1 file changed, 12 insertions(+), 36 deletions(-)

(limited to '.emacs.d/rul-lisp/packages')

diff --git a/.emacs.d/rul-lisp/packages/rul-completion.el b/.emacs.d/rul-lisp/packages/rul-completion.el
index 2b3afa1..3412354 100644
--- a/.emacs.d/rul-lisp/packages/rul-completion.el
+++ b/.emacs.d/rul-lisp/packages/rul-completion.el
@@ -1,5 +1,14 @@
 (use-package orderless :ensure t)
 
+(setq completion-styles '(basic substring initials orderless))
+(setq completion-category-overrides
+      '(
+        (file (styles . (basic partial-completion orderless)))
+        (project-file (styles . (flex basic substring partial-completion orderless)))
+        ))
+
+(setq completion-ignore-case t)
+
 ;; Enable vertico
 (use-package vertico
   :ensure t
@@ -7,50 +16,18 @@
   (vertico-mode)
 
   :config
-  (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy)
-
-  ;; Different scroll margin
-  ;; (setq vertico-scroll-margin 0)
-
-  ;; Show more candidates
-  ;; (setq vertico-count 20)
-
-  ;; Grow and shrink the Vertico minibuffer
-  ;; (setq vertico-resize t)
-
-  ;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
-  ;; (setq vertico-cycle t)
-  )
+  (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy))
 
 ;; Enable rich annotations using the Marginalia package
 (use-package marginalia
   :ensure t
-  ;; Bind `marginalia-cycle' locally in the minibuffer.  To make the binding
-  ;; available in the *Completions* buffer, add it to the
-  ;; `completion-list-mode-map'.
   :bind (:map minibuffer-local-map
          ("M-A" . marginalia-cycle))
-
-  ;; The :init section is always executed.
   :init
-
-  ;; Marginalia must be actived in the :init section of use-package such that
-  ;; the mode gets enabled right away. Note that this forces loading the
-  ;; package.
   (marginalia-mode))
 
-(setq completion-styles '(basic substring initials orderless))
-(setq completion-category-overrides
-      '(
-        (file (styles . (basic partial-completion orderless)))
-        (project-file (styles . (flex basic substring partial-completion orderless)))
-        ))
-
-(setq completion-ignore-case t)
-
 (use-package consult
   :ensure t
-  ;; Replace bindings. Lazily loaded due by `use-package'.
   :bind (;; C-c bindings in `mode-specific-map'
          ("C-c M-x" . consult-mode-command)
          ("C-c h" . consult-history)
@@ -126,7 +103,7 @@
 
   :bind
   (("C-." . embark-act)         ;; pick some comfortable binding
-   ("C-;" . embark-dwim)        ;; good alternative: M-.
+   ("M-." . embark-dwim)        ;; good alternative: M-.
    ("C-h B" . embark-bindings)) ;; alternative for `describe-bindings'
 
   :init
@@ -139,9 +116,8 @@
                  nil
                  (window-parameters (mode-line-format . none)))))
 
-;; Consult users will also want the embark-consult package.
 (use-package embark-consult
-  :ensure t ; only need to install it, embark loads it after consult if found
+  :ensure t
   :hook
   (embark-collect-mode . consult-preview-at-point-mode))
 
-- 
cgit v1.2.3