Good day,

I like the zap to char and zap up to char functions from evil. Since sometimes you would like to delete a prolonged sentence, I use evil-delete with selecting the char by evil-avy-goto-char-in-line. I would like to assign a command to execute both commands with one key. However I am not technical enough to know how I should parse the argument to evil-delete to make this happen. So your help in creating this function would be greatly appreciated (or alternative suggestions how to zap long lines to a particular char). A bonus would be if you could also provide the avy variant of go/zap up to char. I can't imagine how to make this happen without getting deeply involved in editing the avy code, which is obviously is not such a good idea.

  • Maybe consider evilem-motion package with evilem-motion-find-char, it can override the default Evil f/F/t/T.
    – Arktik
    Mar 11, 2023 at 10:40
  • Maybe check out evil-snipe package as well.
    – Arktik
    Mar 11, 2023 at 10:44
  • To my knowledge evil-snipe just jumps to the next to characters indicated. Also don't understand how this would contribute to have evil-delete and evil-avy-goto-char-in-line in one command
    – Rareform
    Mar 15, 2023 at 22:18

2 Answers 2


How about something like this. Note, the F8 key is just an example, I wouldn't use it.

(defun my/zap-to-char-avy ()
  "Delete region from point to a character."
    (set-mark (point))
    (evil-delete (mark) (point) 'block)

(define-key evil-normal-state-map (kbd "<f8>") 'my/zap-to-char-avy)

evil-avy-goto-char-in-line is an evil motion command, which means that you can combine it with d, y, c etc. You could bind it to f using (evil-global-set-key 'motion "f" #'avy-goto-char-in-line), then you can use df for delete, yf for yank etc. (or choose any other available key).

But you might prefer to just use the default f/F keybinding, and then get used to repeat the jumps using ;.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.