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)))
  • 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?


    • 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.

  • Pingback: Super-efficient movement using avy | Pragmatic Emacs » Think *NIX()

  • Kazuki Yoshida

    I personally use this extreme one-step activation setting.

    M-s- will invoke (avy-goto-word-1 )

    where can be any character like alphabets and !?~ etc.

  • Pingback: 2016-04-11 Emacs News - sacha chua :: living an awesome life()

  • etiennebaz

    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 !