From 49a5164f45a90c369482b6aef1a1a2ee7194b280 Mon Sep 17 00:00:00 2001 From: Laurens Miers Date: Sun, 25 May 2025 17:26:06 +0200 Subject: [PATCH] Rework isearch configuration using emacs-solo inspiration --- config.org | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/config.org b/config.org index 6424b85..faed9e1 100644 --- a/config.org +++ b/config.org @@ -167,10 +167,26 @@ Use list-buffers bigger brother. ** Isearch -Display number of matches: -#+begin_src emacs-lisp -(setq-default isearch-lazy-count t) -#+end_src +Inspired by [[https://github.com/LionyxML/emacs-solo][emacs-solo]]: + +#+BEGIN_SRC emacs-lisp +(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: https://endlessparentheses.com/leave-the-cursor-at-start-of-match-after-isearch.html