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