commit 9128e259c4b53c6e08afff95a2beccf2679c3210
parent 5fe6acb087cd522184e1884e2dffc60aa15f353a
Author: Vincent Demeester <vincent@sbr.pm>
Date: Thu, 21 Mar 2024 06:31:24 +0100
tools/emacs: config isearch a little bit…
From https://blog.chmouel.com/posts/emacs-isearch/.
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/tools/emacs/config/config-completion.el b/tools/emacs/config/config-completion.el
@@ -10,6 +10,7 @@
("M-s M-b" . consult-buffer)
("M-s M-f" . consult-find)
("M-s M-g" . consult-grep)
+ ("M-s M-r" . consult-ripgrep)
("M-s M-h" . consult-history)
("M-s M-i" . consult-imenu)
("M-s M-l" . consult-line)
diff --git a/tools/emacs/config/config-navigating.el b/tools/emacs/config/config-navigating.el
@@ -56,7 +56,8 @@
:bind (("C-c j w" . avy-goto-word-1)
("C-c j b" . avy-pop-mark)
("C-c j t" . avy-goto-char-timer)
- ("C-c j l" . avy-goto-line)))
+ ("C-c j l" . avy-goto-line)
+ (:map isearch-mode-map ("C-j" . avy-isearch))))
(use-package mwim
:unless noninteractive
diff --git a/tools/emacs/config/config-search.el b/tools/emacs/config/config-search.el
@@ -7,6 +7,24 @@
(use-package isearch
:unless noninteractive
:config
+ (defun my-project-search-from-isearch ()
+ (interactive)
+ (let ((query (if isearch-regexp
+ isearch-string
+ (regexp-quote isearch-string))))
+ (isearch-update-ring isearch-string isearch-regexp)
+ (let (search-nonincremental-instead)
+ (ignore-errors (isearch-done t t)))
+ (project-find-regexp query)))
+ (defun my-occur-from-isearch ()
+ (interactive)
+ (let ((query (if isearch-regexp
+ isearch-string
+ (regexp-quote isearch-string))))
+ (isearch-update-ring isearch-string isearch-regexp)
+ (let (search-nonincremental-instead)
+ (ignore-errors (isearch-done t t)))
+ (occur query)))
(setq-default search-whitespace-regexp ".*?"
isearch-lax-whitespace t
isearch-regexp-lax-whitespace nil
@@ -49,6 +67,9 @@ confines of word boundaries (e.g. multiple words)."
(when isearch-other-end (goto-char isearch-other-end)))
:bind (("M-s M-o" . multi-occur)
:map isearch-mode-map
+ ("C-o" . my-occur-from-isearch)
+ ("C-f" . my-project-search-from-isearch)
+ ("C-d" . isearch-forward-symbol-at-point)
("DEL" . contrib/isearchp-remove-failed-part-or-last-char)
("<C-return>" . contrib/isearch-done-opposite-end)))
;; -UseISearch