Use :bind for search-map

This commit is contained in:
David Morgan 2022-10-24 16:36:29 +01:00
parent 680a182d61
commit 3ace1ffdb4
Signed by: djm
GPG Key ID: C171251002C200F2
2 changed files with 31 additions and 31 deletions

View File

@ -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)

View File

@ -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)