hlissner/evil-snipe

having different scope for `f` and `t`

liujoey opened this issue · 3 comments

Hello,

Is there anyway to set scope to visible for s/S, while still using scope line for f/t/F/T? Thank you.

Not natively, but I believe you could manage it with:

(defun restrict-to-line-scope (orig-fn &rest args)
  (let ((evil-snipe-scope 'line))
    (apply orig-fn args)))
(advice-add #'evil-snipe-f :around #'restrict-to-line-scope)
(advice-add #'evil-snipe-F :around #'restrict-to-line-scope)
(advice-add #'evil-snipe-t :around #'restrict-to-line-scope)
(advice-add #'evil-snipe-T :around #'restrict-to-line-scope)

I'm working on a rewrite of evil-snipe (it was written when I was still new to Elisp). I'll find a way to work this into it.

Thank you.

Note that such advice doesn't propagate through to ; and , even if you set evil-snipe-repeat-scope in it as well. If you want to have a different evil-snipe-repeat-scope for f/t/F/T as well, I think you have to write a different advice function for evil-snipe-repeat that looks at the internal evil-snipe--last variable to determine the scope properly when repeating.