aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d/lisp/init-minibuffer.el
blob: a0a5c987b0c27f62328e4dd0466cb474a056972a (plain)
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
(gx/maybe-require-package 'consult)

(when (gx/maybe-require-package 'vertico)
  (add-hook 'after-init-hook #'vertico-mode))

(setq vertico-resize t
      vertico-count 20
      vertico-cycle t)

(when (gx/maybe-require-package 'orderless)
  (defun gx/setup-completion-in-minibuffer ()
    (setq-local completion-styles '(substring orderless)
                completion-category-defaults nil
                completion-category-overrides '((file (styles partial-completion)))))
  (add-hook 'minibuffer-setup-hook #'gx/setup-completion-in-minibuffer))

(when (gx/maybe-require-package 'consult)
  (with-eval-after-load 'evil
    (evil-define-key 'normal 'global
      (kbd "<leader>fb") 'consult-buffer
      (kbd "<leader>fm") 'consult-recent-file
      (kbd "<leader>fc") 'execute-extended-command
      (kbd "<leader>fl") 'consult-line
      (kbd "<leader>fs") 'consult-imenu)
    (evil-define-key 'normal 'eglot--managed-mode
      (kbd "<leader>fS") 'consult-eglot-symbols)))

(setq consult-preview-key (kbd "C-c C-p"))

(when (gx/maybe-require-package 'savehist)
  (add-hook 'after-init-hook #'savehist-mode))

(provide 'init-minibuffer)