about summary refs log tree commit diff stats
path: root/.emacs.d/lisp
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2022-10-24 16:36:29 +0100
committerDavid Morgan <djm_uk@protonmail.com>2022-10-24 16:36:29 +0100
commit3ace1ffdb4a799ad7064d40475e9e9f2b6627891 (patch)
treec7f120279aa2b8702d22b39f32c22fd5cba3473e /.emacs.d/lisp
parent680a182d6139ff10a4b017c8695901d576345619 (diff)
downloaddotfiles-3ace1ffdb4a799ad7064d40475e9e9f2b6627891.tar.gz
Use :bind for search-map
Diffstat (limited to '.emacs.d/lisp')
-rw-r--r--.emacs.d/lisp/init-minibuffer.el45
-rw-r--r--.emacs.d/lisp/init-search.el17
2 files changed, 31 insertions, 31 deletions
diff --git a/.emacs.d/lisp/init-minibuffer.el b/.emacs.d/lisp/init-minibuffer.el
index 0d5e5c2..cd9320c 100644
--- a/.emacs.d/lisp/init-minibuffer.el
+++ b/.emacs.d/lisp/init-minibuffer.el
@@ -197,10 +197,28 @@ DEFS is a plist associating completion categories to commands."
          ("M-g k" . consult-global-mark)
          ("M-g i" . consult-imenu)
          ("M-g I" . consult-imenu-multi)
-         :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
+         (: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
+         (:map search-map
+               ("f" . consult-fd)
+               ("F" . consult-find)
+               ("M-f" . consult-locate)
+               ("g" . consult-grep)
+               ("G" . consult-git-grep)
+               ("r" . consult-ripgrep)
+               ("R" . consult-ripgrep) ;; can't use r in isearch-mode, so add R too
+               ("M-r" . consult-ripgrep-unrestricted)
+               ("*" . consult-ripgrep-symbol-at-point)
+               ("z" . consult-z-ripgrep)
+               ("^" . consult-ripgrep-parent)
+               ("l" . consult-line)
+               ("L" . consult-line-multi)
+               ("m" . consult-multi-occur)
+               ("k" . consult-keep-lines)
+               ("u" . consult-focus-lines)
+               ("e" . consult-isearch))
          (:map vertico-map
                ;; These are used for previewing with some consult commands (see consult-customize call below)
                ("C-S-p" . vertico-previous)
@@ -279,25 +297,6 @@ DEFS is a plist associating completion categories to commands."
            (default-directory (cdr prompt-dir)))
       (find-file (consult--find (car prompt-dir) #'consult--fd-builder initial))))
 
-  ;; Add these here, as we have two bindings for search map (M-s and C-c s)
-  (define-key search-map "f" 'consult-fd)
-  (define-key search-map "F" 'consult-find)
-  (define-key search-map (kbd "M-f") 'consult-locate)
-  (define-key search-map "g" 'consult-grep)
-  (define-key search-map "G" 'consult-git-grep)
-  (define-key search-map "r" 'consult-ripgrep)
-  (define-key search-map "R" 'consult-ripgrep) ;; can't use r in isearch-mode, so add R too
-  (define-key search-map (kbd "M-r") 'consult-ripgrep-unrestricted)
-  (define-key search-map "*" 'consult-ripgrep-symbol-at-point)
-  (define-key search-map "z" 'consult-z-ripgrep)
-  (define-key search-map "^" 'consult-ripgrep-parent)
-  (define-key search-map "l" 'consult-line)
-  (define-key search-map "L" 'consult-line-multi)
-  (define-key search-map "m" 'consult-multi-occur)
-  (define-key search-map "k" 'consult-keep-lines)
-  (define-key search-map "u" 'consult-focus-lines)
-  (define-key search-map "e" 'consult-isearch)
-
   (consult-customize
    consult-theme
    :preview-key '(:debounce 0.2 any)
diff --git a/.emacs.d/lisp/init-search.el b/.emacs.d/lisp/init-search.el
index e4a2c7f..b7d5393 100644
--- a/.emacs.d/lisp/init-search.el
+++ b/.emacs.d/lisp/init-search.el
@@ -40,9 +40,8 @@
         ([remap isearch-query-replace-regexp] . anzu-isearch-query-replace-regexp)))
 
 (use-package rg
-  :config
-  (define-key search-map "s" 'rg)
   :bind
+  (:map search-map ("s" . rg))
   ("C-c C-M-S-r" . rg-menu)
   ("C-c C-M-r" . rg)
   ("C-z" . rg-dwim))
@@ -52,9 +51,10 @@
   (defun deadgrep-symbol-at-point ()
     (interactive)
     (deadgrep (thing-at-point 'symbol)))
-  (define-key search-map "d" 'deadgrep)
-  (define-key search-map "D" 'deadgrep-symbol-at-point)
   :bind
+  (:map search-map
+        ("d" . deadgrep)
+        ("D" . deadgrep-symbol-at-point))
   ("C-S-z" . deadgrep-symbol-at-point)
   ("C-c c d" . deadgrep))
 
@@ -78,11 +78,12 @@
      (list prefix-arg (when-let ((s (symbol-at-point)))
                         (symbol-name s))))
     (affe-find dir initial))
-  (define-key search-map "#" 'affe-grep)
-  (define-key search-map "~" 'my/affe-grep-symbol-at-point)
-  (define-key search-map "a" 'affe-find)
-  (define-key search-map "A" 'my/affe-find-symbol-at-point)
   :bind
+  (:map search-map
+        ("#" . affe-grep)
+        ("~" . my/affe-grep-symbol-at-point)
+        ("a" . affe-find)
+        ("A" . my/affe-find-symbol-at-point))
   ("C-#" . affe-grep)
   ("C-c z" . affe-find)
   ("C-c Z" . my/affe-find-symbol-at-point)