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