Commit d8d2d9164d17
Changed files (1)
tools
emacs
config
tools/emacs/config/config-search.el
@@ -1,13 +1,6 @@
;;; -*- lexical-binding: t; -*-
-;; Ignore directories during grep
-(with-eval-after-load 'grep
- '(progn
- (add-to-list 'grep-find-ignored-directories "auto")
- (add-to-list 'grep-find-ignored-directories "elpa")))
-
-;; Truncate lines during grep
-(add-hook 'grep-mode-hook #'toggle-truncate-lines)
+;; UseISearch
(use-package isearch
:disabled
:config
@@ -52,6 +45,56 @@ confines of word boundaries (e.g. multiple words)."
:map isearch-mode-map
("DEL" . contrib/isearchp-remove-failed-part-or-last-char)
("<C-return>" . contrib/isearch-done-opposite-end)))
+;; -UseISearch
+
+;; UseGrep
+(use-package grep
+ :commands (find-grep grep find-grep-dired find-name-dired)
+ :bind (("M-s n" . find-name-dired)
+ ("M-s F" . find-grep)
+ ("M-s G" . grep)
+ ("M-s d" . find-grep-dired))
+ :hook ((hook-mode . toggle-truncate-lines))
+ :config
+ (add-to-list 'grep-find-ignored-directories "auto")
+ (add-to-list 'grep-find-ignored-directories "elpa"))
+;; -UseGrep
+
+;; UseWgrep
+(use-package wgrep
+ :commands (wgrep-change-to-wgrep-mode)
+ :defer 2
+ :custom
+ (wgrep-auto-save-buffer t)
+ (wgrep-change-readonly-file t))
+;; -UseWgrep
+
+;; UseRG
+(use-package rg
+ :if *rg*
+ :commands (rg rg-project rg-dwim)
+ :bind (("M-s r r" . rg)
+ ("M-s r p" . rg-project)
+ ("M-s r s" . rg-dwiw))
+ :hook (after-init . rg-enable-default-binding)
+ :config
+ (with-eval-after-load 'projectile
+ (defalias 'projectile-ripgrep #'rg-project)))
+;; -UseRG
+
+(use-package swiper
+ :disabled
+ :after ivy
+ :custom
+ (swiper-action-recenter t)
+ (swiper-goto-start-of-match t)
+ (swiper-include-line-number-in-search t)
+ :bind (("C-S-s" . swiper)
+ ("M-s s" . swiper-multi)
+ ("M-s w" . swiper-thing-at-point)
+ :map swiper-map
+ ("M-y" . yank)
+ ("C-." . swiper-avy)))
(use-package anzu
:disabled
@@ -70,29 +113,4 @@ confines of word boundaries (e.g. multiple words)."
([remap query-replace-regexp] . anzu-query-replace-regexp)
("M-s %" . anzu-query-replace-at-cursor))
-(use-package swiper
- :disabled
- :after ivy
- :custom
- (swiper-action-recenter t)
- (swiper-goto-start-of-match t)
- (swiper-include-line-number-in-search t)
- :bind (("C-S-s" . swiper)
- ("M-s s" . swiper-multi)
- ("M-s w" . swiper-thing-at-point)
- :map swiper-map
- ("M-y" . yank)
- ("C-." . swiper-avy)))
-
-(use-package wgrep
- :disabled
- :defer 2
- :custom
- (wgrep-auto-save-buffer t)
- (wgrep-change-readonly-file t))
-
-(use-package rg
- :disabled
- :hook (after-init . rg-enable-default-binding))
-
(provide 'setup-search)