hlissner/evil-snipe

Binding `S` is undefined

rieje opened this issue · 5 comments

rieje commented

Disclaimer: I'm somewhat of an emacs noob.

With regards to evil-snipe I have just this:

(use-package evil-snipe
  :ensure t
  :config
  (setq  evil-snipe-scope 'whole-visible))

When I restart emacs, S is undefined, instead of evil's evil-change-whole-line. Shouldn't evil-snipe only rebind the key if the mode is enabled? I want the native evil functionality.

P.S. What I'm trying to achieve is this: I want to use just evil-snipe's multi-line ftFT and repeat search functionality with ftFT (so nothing else--no rebinding of any keys except ftFT to repeat the searches) because I'm already using avy. I know the above settings do not accomplish this yet, but that isn't the issue. Do I need to rebind all evil-snipe bindings to the defaults or can I disable all the bindings or something?

Thanks for letting me know!

This is somewhat intended. At the time I wrote evil-snipe, I couldn't get evil-snipe to reliably override the default s / S bindings from evil-snipe-mode-map. I can't remember if I settled on unsetting them because it was the only thing that worked, or I was too inexperienced with Elisp to know how to do it properly.

In any case, could you try adding this to the end of your evil-snipe config:

(evil-define-key* '(normal motion) evil-snipe-mode-map
      "s" #'evil-snipe-s
      "S" #'evil-snipe-S)

(define-key evil-normal-state-map "s" 'evil-substitute)
(define-key evil-normal-state-map "S" 'evil-change-whole-line)

And let me know if that works. If it does, then I will merge that into evil-snipe proper.

rieje commented

Yes, this fixes it. Thanks :)

I've pushed the fix into master. After you update, you can safely remove the snippet I suggested above. I'll consider this resolved. Feel free to reopen it if the problem resurfaces.

rieje commented

I think there might be an unrelated bug with the update--the highlighted characters don't "exit" after ftFT. Do you have this problem? The pic shows what happens when I ftFT a few characters--previously ftFT'ed characters remain highlighted.

My bad! I've just pushed a fix. Let me know if it persists.