Rework isearch configuration using emacs-solo inspiration

This commit is contained in:
Laurens Miers 2025-05-25 17:26:06 +02:00
parent 22c029b2f4
commit 49a5164f45

View file

@ -167,10 +167,26 @@ Use list-buffers bigger brother.
** Isearch ** Isearch
Display number of matches: Inspired by [[https://github.com/LionyxML/emacs-solo][emacs-solo]]:
#+begin_src emacs-lisp
(setq-default isearch-lazy-count t) #+BEGIN_SRC emacs-lisp
#+end_src (use-package isearch
:ensure nil
:config
(setq isearch-lazy-count t) ; Display number of matches
(setq lazy-count-prefix-format "(%s/%s) ") ; eye-candy to add braces
(defun isearch-copy-selected-word ()
"Copy the current `isearch` selection to the kill ring."
(interactive)
(when isearch-other-end
(let ((selection (buffer-substring-no-properties isearch-other-end (point))))
(kill-new selection)
(isearch-exit))))
;; Bind `M-w` in isearch to copy the selected word, so M-s M-. M-w
;; does a great job of 'copying the current word under cursor'.
(define-key isearch-mode-map (kbd "M-w") 'isearch-copy-selected-word))
#+END_SRC
Reference that might be interesting for later: Reference that might be interesting for later:
https://endlessparentheses.com/leave-the-cursor-at-start-of-match-after-isearch.html https://endlessparentheses.com/leave-the-cursor-at-start-of-match-after-isearch.html