Skip to content

Commit 4016322

Browse files
committed
default: add omnicompletion bindings to minibuffer
This commit adds omnicompletion bindings to the minibuffer. This is only done for Corfu because we do not currently enable Company in the minibuffer. This is primarily because sometimes I want to insert a file name into the minibuffer and want to do so with C-x C-f. If you have any suggestions on improving this, please comment below. Not all the bindings are added, because some of them do not make sense in the minibuffer unless you wrap them with special forms.
1 parent 2bc0524 commit 4016322

3 files changed

Lines changed: 41 additions & 16 deletions

File tree

lisp/doom-keybinds.el

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,21 @@ and Emacs states, and for non-evil users.")
3131
(defvar doom-leader-map (make-sparse-keymap)
3232
"An overriding keymap for <leader> keys.")
3333

34+
(defvar doom-minibuffer-maps
35+
(append '(minibuffer-local-map
36+
minibuffer-local-ns-map
37+
minibuffer-local-completion-map
38+
minibuffer-local-must-match-map
39+
minibuffer-local-isearch-map
40+
read-expression-map)
41+
(cond ((modulep! :completion ivy)
42+
'(ivy-minibuffer-map
43+
ivy-switch-buffer-map))
44+
((modulep! :completion helm)
45+
'(helm-map
46+
helm-rg-map
47+
helm-read-file-map))))
48+
"A list of all the keymaps used for the minibuffer.")
3449

3550
;;
3651
;;; Global keybind settings

modules/config/default/config.el

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,7 @@
33
(defvar +default-want-RET-continue-comments t
44
"If non-nil, RET will continue commented lines.")
55

6-
(defvar +default-minibuffer-maps
7-
(append '(minibuffer-local-map
8-
minibuffer-local-ns-map
9-
minibuffer-local-completion-map
10-
minibuffer-local-must-match-map
11-
minibuffer-local-isearch-map
12-
read-expression-map)
13-
(cond ((modulep! :completion ivy)
14-
'(ivy-minibuffer-map
15-
ivy-switch-buffer-map))
16-
((modulep! :completion helm)
17-
'(helm-map
18-
helm-rg-map
19-
helm-read-file-map))))
20-
"A list of all the keymaps used for the minibuffer.")
21-
6+
(defvaralias '+default-minibuffer-maps 'doom-minibuffer-maps)
227

238
;;
249
;;; Reasonable defaults

modules/editor/evil/config.el

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,3 +581,28 @@ directives. By default, this only recognizes C directives.")
581581
:i "C-o" #'completion-at-point
582582
:i "C-n" #'cape-dabbrev
583583
:i "C-p" #'+corfu/dabbrev-this-buffer))))
584+
585+
586+
(unless evil-disable-insert-state-bindings
587+
(when (modulep! :completion company)
588+
(define-key!
589+
:keymaps (append doom-minibuffer-maps
590+
(when (modulep! :editor evil +everywhere)
591+
'(evil-ex-completion-map)))
592+
"C-x C-f" #'company-files
593+
"C-x s" #'company-ispell
594+
"C-x C-s" #'company-yasnippet
595+
"C-x C-o" #'company-capf
596+
"C-x C-n" #'+company/dabbrev
597+
"C-x C-p" #'+company/dabbrev-code-previous))
598+
(when (modulep! :completion corfu)
599+
(define-key!
600+
:keymaps (append doom-minibuffer-maps
601+
(when (modulep! :editor evil +everywhere)
602+
'(evil-ex-completion-map)))
603+
"C-x C-f" #'cape-file
604+
"C-x s" #'cape-dict
605+
"C-x C-s" #'yasnippet-capf
606+
"C-x C-o" #'completion-at-point
607+
"C-x C-n" #'cape-dabbrev
608+
"C-x C-p" #'+corfu/dabbrev-this-buffer)))

0 commit comments

Comments
 (0)