Is there a good way to do this? Much of the time I find myself using avy-mode I only want to jump somewhere within the current paragraph or line. With stock avy, this involves entering numerous keys to select a nearby location. How is this done? Or maybe my usage of avy here is flawed, and there is a better way to use it?

2 Answers 2


The avy commands like avy-goto-char run avy--generic-jump underneath, and that function takes a begin/end range. Here's a proof of concept modification to avy-goto-char that runs on the paragraph:

(defun avy-goto-char-in-paragraph (char)
  "Jump to the currently visible CHAR in current paragraph."
  (interactive (list (read-char "char: " t)))
  (let (beg end)
      (setq end (point))
      (setq beg (point)))
    (avy-with avy-goto-char
               (regexp-quote (string char))

You could make a version of the commands you want by modifying how beg/end are calculated (line vs paragraph vs defun etc.).


The avy package provides the command avy-goto-line for this:

avy-goto-line is an interactive autoloaded compiled Lisp function in

(avy-goto-line &optional ARG)

Jump to a line start in current buffer.

When ARG is 1, jump to lines currently visible, with the option
to cancel to ‘goto-line’ by entering a number.

When ARG is 4, negate the window scope determined by

Otherwise, forward to ‘goto-line’ with ARG.

See also the project's README: https://github.com/abo-abo/avy#avy-goto-line

There are also the more restricted variants avy-goto-line-above and avy-goto-line-below which only consider lines above and below the current line, respectively.

There are no paragraph-specific commands as far as I'm aware; if you think this would be a useful addition you may consider suggesting it on the project's issue tracker: https://github.com/abo-abo/avy/issues

  • 1
    Thanks, but the question is about confining the avy search (e.g., avy-goto-char) to the current line or paragraph, not searching to a specific line.
    – Dodgie
    Commented Jan 24, 2018 at 19:20
  • Woops, so it is. Sorry about the confusion.
    – Basil
    Commented Jan 24, 2018 at 19:22
  • All is forgiven :)
    – Dodgie
    Commented Jan 24, 2018 at 19:23

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.