0

Following the Use avy to select distant word or line and paste at point thread I want the following action - select a letter as in the thread, when the letters for avy selection arrive press a number x, yank the region selected by expand region er/expand-region where expand region is counted/extended x times and then paste it at the current spot.

If no number is given the standard behavior as in the source thread should be provided, if a number is given the 'expand region pasting' as described here should be the action. I am using doom emacs on Mac OS.

So far the function looks like this:

(defun my-avy-paste-word (char)
  "Paste a word selected with avy."
  (interactive (list (read-char "char:" t)))
  (let ((avy-action #'avy-action-copy))
    (when (avy-jump (concat "\\b" (string char)))
      (yank))))

Questions:

a) How can I choose only candidates below or above, so candidates above and below the cursor are chosen.

b) How can I have er/expand-region with an argument responsible for how much I put into my kill ring before pasting it at point.

0

Your Answer

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

Browse other questions tagged or ask your own question.