Super-efficient movement using avy

One of the revelations I came to after a while of using emacs is that you can use searching (or swiping) to efficiently move to another place in the visible buffer. In other words, you can see the place that you want the cursor to be so you do a search for a word close to that position to move the cursor there – not because you want to find that word.

The package avy gives an even more efficient way to do this. There are a few options, but with the configuration below, I look at the place I want the cursor to be, hit M-s and type the first character of a word close to that position, and then the short string that appears in order to select the word that I want and the cursor jumps there. Once you get used to it, it almost feels like you can move the cursor just by looking where you want it to go!

In the animation below I want to move the cursor to the start of the word “formed” near the bottom of the window, so I hit M-s and then f. avy then overlays letter combinations on all words starting f and I type “la” to move to the word I want.


Here is my configuration code for avy

(use-package avy
  :ensure t
  :bind (("M-s" . avy-goto-word-1)))


  1. I may see the advantage while programming, where there are lots of repetitions of the same exact words, but for normal text, why is it any faster than just using the isearch and type part of the word till you are there?. also, c-s can help you travel around repetitions.

    Appart from ‘saving’ or ‘wasting’ a couple of keystrokes, I find the predictability of typing prefixes of a known word less stressing that playing whack-a-mole with the new letters you are asked to type. How do you feel about it?



    1. One thing I didn’t mention was that the default behaviour is that the lead letters that appear are chosen to be on the home row (A-L) keys, so if you are a touch typer you can hit them without thinking too much about it.

      Another useful feature I didn’t mention is that if you have multiple windows open in your frame, avy will display lead letters for all frames so you can jump to a word in a different frame.


  2. I am sorry for this out of topic question but what is the emacs theme you’re using in the animation of the article ? Nice tips by the way !


  3. Thanks for this post; this was my introduction to avy and I use it all the time now. I’ve combined avy with key-chord ( and now have avy-goto-char-timer bound to “jj” which makes for a really quick invocation. I also like having a visual indicator that I’ve successfully invoked the command, so added the following to flash the mode-line:

    (defun avy-flash ()
    (set-face-attribute ‘mode-line nil :background “#50AA50”)
    (run-with-timer 0.25 nil ‘set-face-attribute ‘mode-line nil :background “grey75”)

    I find it helpful for keeping your eyes centered on the text in the window you’re interested in.

    Thanks for all the helpful posts; this is one of my favorite emacs blogs and has been a great resource for discovering useful packages.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s