Rework isearch configuration using emacs-solo inspiration
This commit is contained in:
parent
22c029b2f4
commit
49a5164f45
1 changed files with 20 additions and 4 deletions
24
config.org
24
config.org
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue