hlissner / evil-snipe

2-char searching ala vim-sneak & vim-seek, for evil-mode
MIT License
336 stars 25 forks source link

How to repeat searches after rebinding f to evil-snipe-s #89

Closed rommeswi closed 1 year ago

rommeswi commented 1 year ago

What would you like to know?

I want to use 2-character sniping on f and repeat searches also on f

Rebinding 2 character sniping is easy: (with-eval-after-load 'evil-snipe (evil-define-key '(normal motion) evil-snipe-local-mode-map "s" nil "S" nil "f" 'evil-snipe-s "F" 'evil-snipe-S)) However, to repeat searches I then have to use s. I tried many ways of overriding the evil-snipe-override-local-mode-map to "f" evil-snipe-repeat but it usually just overrides the 2 character sniping or simply does not work. What is the correct way to do this?

rommeswi commented 1 year ago

It turned out I was trying to rebind the wrong keymap. A quick look into the code solved my misunderstanding:

(with-eval-after-load 'evil-snipe (setq evil-snipe-parent-transient-map (let ((map (make-sparse-keymap))) (define-key map "f" #'evil-snipe-repeat) (define-key map "F" #'evil-snipe-repeat-reverse) map)))