|
12 | 12 | "C-c M-x" = "consult-mode-command"; |
13 | 13 | "C-c h" = "consult-history"; |
14 | 14 | "C-c k" = "consult-kmacro"; |
15 | | - "C-c m" = "consult-man"; |
16 | 15 | "C-c i" = "consult-info"; |
17 | 16 | # ([remap Info-search] = "consult-info"; |
18 | 17 | # C-x bindings (ctl-x-map) |
|
67 | 66 | }; |
68 | 67 |
|
69 | 68 | init = '' |
70 | | - (require 'consult-xref) |
71 | | - (require 'consult-org) |
72 | | -
|
73 | | - ;; Optionally configure the register formatting. This improves the register |
74 | | - ;; preview for `consult-register', `consult-register-load', |
75 | | - ;; `consult-register-store' and the Emacs built-ins. |
76 | | - (setq register-preview-delay 0.5 |
77 | | - register-preview-function #'consult-register-format) |
78 | | -
|
79 | | - ;; Optionally tweak the register preview window. |
80 | | - ;; This adds thin lines, sorting and hides the mode line of the window. |
81 | | - (advice-add #'register-preview :override #'consult-register-window) |
82 | | -
|
83 | | - ;; Use Consult to select xref locations with preview |
84 | | - (setq xref-show-xrefs-function #'consult-xref |
85 | | - xref-show-definitions-function #'consult-xref) |
86 | | -
|
87 | | - ;; Configure other variables and modes in the :config section, |
88 | | - ;; after lazily loading the package. |
89 | | - :config |
90 | | -
|
91 | | - ;; Optionally configure preview. The default value |
92 | | - ;; is 'any, such that any key triggers the preview. |
93 | | - ;; (setq consult-preview-key 'any) |
94 | | - ;; (setq consult-preview-key "M-.") |
95 | | - ;; (setq consult-preview-key '("S-<down>" "S-<up>")) |
96 | | - ;; For some commands and buffer sources it is useful to configure the |
97 | | - ;; :preview-key on a per-command basis using the `consult-customize' macro. |
98 | | - (consult-customize |
99 | | - consult-theme :preview-key '(:debounce 0.2 any) |
100 | | - consult-ripgrep consult-git-grep consult-grep |
101 | | - consult-bookmark consult-recent-file consult-xref |
102 | | - ;; :preview-key "M-." |
103 | | - :preview-key '(:debounce 0.4 any)) |
104 | | -
|
105 | | - ;; Optionally configure the narrowing key. |
106 | | - ;; Both < and C-+ work reasonably well. |
107 | | - (setq consult-narrow-key "<") ;; "C-+" |
108 | | -
|
109 | | - ;; Optionally make narrowing help available in the minibuffer. |
110 | | - ;; You may want to use `embark-prefix-help-command' or which-key instead. |
111 | | - ;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help) |
112 | | -
|
113 | | - ;; By default `consult-project-function' uses `project-root' from project.el. |
114 | | - ;; Optionally configure a different project root function. |
115 | | - ;;;; 1. project.el (the default) |
116 | | - ;; (setq consult-project-function #'consult--default-project--function) |
117 | | - ;;;; 2. vc.el (vc-root-dir) |
118 | | - ;; (setq consult-project-function (lambda (_) (vc-root-dir))) |
119 | | - ;;;; 3. locate-dominating-file |
120 | | - ;; (setq consult-project-function (lambda (_) (locate-dominating-file "." ".git"))) |
121 | | - ;;;; 4. projectile.el (projectile-project-root) |
122 | | - ;; (autoload 'projectile-project-root "projectile") |
123 | | - ;; (setq consult-project-function (lambda (_) (projectile-project-root))) |
124 | | - ;;;; 5. No project support |
125 | | - ;; (setq consult-project-function nil) |
| 69 | + ;; These settings can be applied before consult loads since they |
| 70 | + ;; configure built-in Emacs variables, not consult functions. |
| 71 | + (setq register-preview-delay 0.5 |
| 72 | + register-preview-function #'consult-register-format) |
126 | 73 |
|
| 74 | + ;; Optionally tweak the register preview window. |
| 75 | + (advice-add #'register-preview :override #'consult-register-window) |
| 76 | +
|
| 77 | + ;; Use Consult to select xref locations with preview |
| 78 | + (setq xref-show-xrefs-function #'consult-xref |
| 79 | + xref-show-definitions-function #'consult-xref) |
| 80 | +
|
| 81 | + ;; org clock (can be set before consult loads) |
| 82 | + (setq org-clock-persist t) |
| 83 | + (with-eval-after-load 'org |
| 84 | + (org-clock-persistence-insinuate)) |
| 85 | + ''; |
| 86 | + |
| 87 | + config = '' |
| 88 | + (require 'consult-xref) |
| 89 | + (require 'consult-org) |
| 90 | +
|
| 91 | + ;; Configure preview keys per-command |
| 92 | + (consult-customize |
| 93 | + consult-theme :preview-key '(:debounce 0.2 any) |
| 94 | + consult-ripgrep consult-git-grep consult-grep |
| 95 | + consult-bookmark consult-recent-file consult-xref |
| 96 | + :preview-key '(:debounce 0.4 any)) |
| 97 | +
|
| 98 | + ;; Configure the narrowing key. |
| 99 | + (setq consult-narrow-key "<") |
127 | 100 |
|
128 | 101 | (defvar consult--previous-point nil |
129 | 102 | "Location of point before entering minibuffer. |
|
158 | 131 | (length vertico--candidates)))))) |
159 | 132 | (setq consult--previous-point nil)) |
160 | 133 |
|
161 | | - ;; org clock |
162 | | -
|
163 | | - (setq org-clock-persist t) |
164 | | - (with-eval-after-load 'org |
165 | | - (org-clock-persistence-insinuate)) |
166 | | -
|
167 | 134 | (defun consult-clock-in (&optional match scope resolve) |
168 | 135 | "Clock into an Org heading." |
169 | 136 | (interactive (list nil nil current-prefix-arg)) |
|
220 | 187 | # }; |
221 | 188 | # }; |
222 | 189 |
|
223 | | - # embark-consult = { |
224 | | - # enable = true; |
225 | | - # after = [ |
226 | | - # "embark" |
227 | | - # "consult" |
228 | | - # ]; |
229 | | - # hook = [ |
230 | | - # "(embark-collect-mode . consult-preview-at-point-mode)" |
231 | | - # # "(prog-mode . lsp)" |
232 | | - # ]; |
233 | | - # }; |
| 190 | + embark-consult = { |
| 191 | + enable = true; |
| 192 | + after = [ |
| 193 | + "embark" |
| 194 | + "consult" |
| 195 | + ]; |
| 196 | + hook = [ |
| 197 | + "(embark-collect-mode . consult-preview-at-point-mode)" |
| 198 | + ]; |
| 199 | + }; |
234 | 200 | }; |
235 | 201 | }; |
236 | 202 | }; |
|
0 commit comments