abo-abo / avy

Jump to things in Emacs tree-style
1.74k stars 111 forks source link

It would be nice to use avy to zapping. #201

Closed AttilaVM closed 7 years ago

AttilaVM commented 7 years ago

Emacs built-in zap-to-char is powerful function, however sometimes not enough, it would be nice to zap in avy style. I wrote a dirty little function, which does the trick...

(defun my/avy-zap-to-char-2 ()
  "Zap to the currently visible CHAR1 followed by CHAR2.
The window scope is determined by `avy-all-windows' (ARG negates it)."
  (interactive)
    (call-interactively 'set-mark-command)
    (call-interactively 'avy-goto-char-2)
    (call-interactively 'kill-region))

Since I am not elisp expert, it is very likely that it is not very idiomatic...

abo-abo commented 7 years ago

There's already a package on MELPA for this: https://github.com/cute-jumper/avy-zap. See if it works for you.