hlissner / evil-snipe

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

make binding s configurable #54

Closed wbolster closed 6 years ago

wbolster commented 6 years ago

the s and S binds override the standard evil/vim substitute command, which my fingers rely on, so i manually disable those in my config like this:

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

i recently had to change my config after an evil-snipe upgrade since the map name changed.

this got me wondering why overriding behaviour is non-optional?

(defvar evil-snipe-local-mode-map
  (let ((map (make-sparse-keymap)))
    (evil-define-key* '(normal motion) map
      "s" #'evil-snipe-s
      "S" #'evil-snipe-S)
    (if evil-snipe-use-vim-sneak-bindings
        (evil-define-key* 'operator map
          "z" #'evil-snipe-x
          "Z" #'evil-snipe-X)
      (evil-define-key* 'operator map
        "z" #'evil-snipe-s
        "Z" #'evil-snipe-S
        "x" #'evil-snipe-x
        "X" #'evil-snipe-X))
    map))

is the current map definition. a (when ...) around that part and a defcustom for it would work i think?

an alternative would be to not use the minor modes at all, but that would mean i have to bind everything myself.

what do you think makes most sense?

hlissner commented 6 years ago

Evil-snipe takes after vim-sneak and vim-seek, both of whom bind s+S. I think it makes the most sense to adhere to this default and leave it to people to un/rebind as they like (as you have). After all, if I add a defcustom for s/S, why not x/X and z/Z as well? I'd rather keep things simple and leave it as is.

wbolster commented 6 years ago

ok, makes sense. i will consider not using the minor mode at all and just binding a few relevant features myself.