summary refs log tree commit diff
diff options
context:
space:
mode:
authornoa2024-10-09 15:12:48 +0800
committernoa2024-10-09 15:12:48 +0800
commit42d657ef778ae3260aea4f2d4682be24d0fe89a9 (patch)
tree0b1f1bf6174b4e057448ec797066994d2d0caa8d
parente0fe995223de274eabc7940561760048003d44a9 (diff)
Update consult to use use-package
-rw-r--r--emacs/init.el26
1 files changed, 13 insertions, 13 deletions
diff --git a/emacs/init.el b/emacs/init.el
index af6d4ec..d30b7e1 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -432,19 +432,19 @@ The misspelled word is taken from OVERLAY.  WORD is the corrected word."
 (setopt mouse-prefer-closest-glyph t)
 
 ;; Consult is a package to provide navigation commands that take advantage of completing-read.  I set up a nice completing-read environment earlier with vertico.  There are a lot of commands built in to consult, and it's possible to define more.  But i use it very simply.
-;; (package-ensure 'consult)
-;; (package-activate 'consult)
-
-;; Consult buffer can be used instead of the default buffer menu.  It lists recently used files and bookmarks as well as open buffers.
-(autoload #'consult-buffer "consult" nil t)
-(global-set-key [remap switch-to-buffer] #'consult-buffer)
-
-;; These are some other almost default functions but with extra interactivity.
-(global-set-key [remap yank-pop] #'consult-yank-pop)
-(global-set-key [remap goto-line] #'consult-goto-line)
-(global-set-key [remap imenu] #'consult-imenu)
-
-(global-set-key [remap info] #'consult-info)
+(use-package consult
+  :ensure t
+  :bind
+  (([remap switch-to-buffer] . consult-buffer)
+   ([remap yank-pop] . consult-yank-pop)
+   ([remap goto-line] . consult-goto-line)
+   ([remap imenu] . consult-imenu)
+   ([remap info] . consult-info)
+   ([remap repeat-complex-command] . consult-complex-command)
+   ([remap bookmark-jump] . consult-bookmark))
+  :custom
+  ;; Use consult for completion at point
+  (completion-in-region-function 'consult-completion-in-region))
 
 ;; Annotations for completing-read
 ;; Marginalia provides us with annotations for candidates in completing read functions.  This is things like docstrings for functions, file permissions in find-file, and so on.  It's a small quality of life improvement.