summary refs log tree commit diff
path: root/emacs/custom/my-completion.el
blob: 005dc81810f8036a0d52798775ddac06320b8b44 (plain) (blame)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
;;; my-completion.el --- Configure parts related to completion -*- lexical-binding: t -*-

;;; Commentary:

;;; Code:

(require 'use-package)

(use-package vertico
  :ensure t
  :init
  (vertico-mode)
  (vertico-multiform-mode 1)

  (setq vertico-multiform-categories
        '((consult-grep buffer)))

  (setq vertico-multiform-commands
        '((consult-imenu buffer)
          (consult-ripgrep buffer)
          (consult-org-heading buffer )
          (consult-outline buffer))))

(use-package orderless
  :ensure t
  :custom
  (completion-styles '(orderless basic))
  (completion-category-defaults nil) )

(use-package marginalia
  :ensure t
  :init
  (marginalia-mode))

(use-package consult
  :ensure t
  :bind (("C-c h"   . consult-history)
         ("C-c m"   . consult-mode-command)
         ("C-x b"   . consult-buffer)
         ("C-x 4 b" . consult-buffer-other-window)
         ("C-x r b" . consult-bookmark)
         ("C-x p b" . consult-project-buffer)
         ("C-c i"   . consult-imenu)
         ("C-c f"   . consult-git-grep)
         ("C-c /"   . consult-ripgrep)
         ("M-y"     . consult-yank-pop)
         ("M-g e"   . consult-compile-error)
         ("M-g f"   . consult-flymake)
         ("M-g M-g" . consult-goto-line)
         ("M-g O"   . consult-outline)
         ("M-g o"   . consult-org-heading)
         ("M-g m"   . consult-mark)
         ("M-g k"   . consult-global-mark)
         ("M-s l"   . consult-line)
         ("M-s L"   . consult-line-multi)
         ;; Isearch integration
         ("C-s" . consult-isearch-history)
         :map isearch-mode-map
         ("M-e" . consult-isearch-history)   ;; orig. isearch-edit-string
         ("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
         ("M-s l" . consult-line) ;; needed by consult-line to detect isearch
         ("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
         ))

(use-package corfu
  :ensure t
  :custom
  (corfu-cycle t)  ;; Enable cycling for `corfu-next/previous'
  (corfu-auto t)   ;; Enable auto completion
  :init
  (corfu-global-mode))

(provide 'my-completion)
;;; my-completion.el ends here