forked from purcell/emacs.d
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit-minibuffer.el
50 lines (37 loc) · 1.89 KB
/
init-minibuffer.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
;;; init-minibuffer.el --- Config for minibuffer completion -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(when (maybe-require-package 'vertico)
(add-hook 'after-init-hook 'vertico-mode)
(when (maybe-require-package 'embark)
(with-eval-after-load 'vertico
(define-key vertico-map (kbd "C-c C-o") 'embark-export)
(define-key vertico-map (kbd "C-c C-c") 'embark-act)))
(when (maybe-require-package 'consult)
(defmacro sanityinc/no-consult-preview (&rest cmds)
`(with-eval-after-load 'consult
(consult-customize ,@cmds :preview-key "M-P")))
(sanityinc/no-consult-preview
consult-ripgrep
consult-git-grep consult-grep
consult-bookmark consult-recent-file consult-xref
consult--source-recent-file consult--source-project-recent-file consult--source-bookmark)
(when (and (executable-find "rg"))
(defun sanityinc/consult-ripgrep-at-point (&optional dir initial)
(interactive (list current-prefix-arg (when-let ((s (symbol-at-point)))
(symbol-name s))))
(consult-ripgrep dir initial))
(sanityinc/no-consult-preview sanityinc/consult-ripgrep-at-point)
(global-set-key (kbd "M-?") 'sanityinc/consult-ripgrep-at-point))
(global-set-key [remap switch-to-buffer] 'consult-buffer)
(global-set-key [remap switch-to-buffer-other-window] 'consult-buffer-other-window)
(global-set-key [remap switch-to-buffer-other-frame] 'consult-buffer-other-frame)
(global-set-key [remap goto-line] 'consult-goto-line)
(when (maybe-require-package 'embark-consult)
(with-eval-after-load 'embark
(require 'embark-consult)
(add-hook 'embark-collect-mode-hook 'embark-consult-preview-minor-mode)))))
(when (maybe-require-package 'marginalia)
(add-hook 'after-init-hook 'marginalia-mode))
(provide 'init-minibuffer)
;;; init-minibuffer.el ends here