Closed MicahElliott closed 3 years ago
But symbol-overlay-map
is already a configurable thing, so here you can just rebind s
as desired - no need for any ad-hoc additional methods.
Thanks @purcell ! That works. I ended up doing in my init.el
basically what I see now in the lovely README:
(defvar my-symbol-overlay-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "i") 'symbol-overlay-put)
(define-key map (kbd "h") 'symbol-overlay-map-help)
(define-key map (kbd "p") 'symbol-overlay-jump-prev)
(define-key map (kbd "n") 'symbol-overlay-jump-next)
(define-key map (kbd "<") 'symbol-overlay-jump-first)
(define-key map (kbd ">") 'symbol-overlay-jump-last)
(define-key map (kbd "w") 'symbol-overlay-save-symbol)
(define-key map (kbd "t") 'symbol-overlay-toggle-in-scope)
(define-key map (kbd "e") 'symbol-overlay-echo-mark)
(define-key map (kbd "d") 'symbol-overlay-jump-to-definition)
(define-key map (kbd "s") 'swiper-isearch-thing-at-point) ; THIS IS THE ONLY CUSTOMIZATION FOR NOW
(define-key map (kbd "q") 'symbol-overlay-query-replace)
(define-key map (kbd "r") 'symbol-overlay-rename)
map)
"Keymap automatically activated inside overlays.
You can re-bind the commands to any keys you prefer.")
(setq symbol-overlay-map my-symbol-overlay-map)
And for overriding ivy's boundaries:
;; Override to not insert boundaries; should request it be a customize-ation
(defun ivy--insert-symbol-boundaries ()
(undo-boundary)
;; next two surely not needed
(beginning-of-line)
(end-of-line))
Now on an active overlay'd word, I can just press s
and be in the swiper search I'm after. Definitely faster than using a key-chord (or whatever) and then pressing M-n
.
Why not just change the existing keymap?
(with-eval-after-load 'symbol-overlay
(define-key symbol-overlay-map (kbd "s") 'swiper-isearch-thing-at-point))
When point is on an active/overlaid word, pressing
s
invokessymbol-overlay-isearch-literally
(and that's not ideal for some of us). If you use ivy/swiper-isearch (or maybe helm) instead of isearch, you're stuck in an awkward isearch.It'd be nicer if instead pressing
s
would invoke a configurable searcher.