(or emacs irrelevant)

Free avy with your goto-line

I have a fondness for Emacs commands and key bindings that you can get for free. Here, by "free" I mean customizations that don't require you to change your old workflow (i.e. unbind your old bindings), but still get the new workflow with comfortable bindings.

  • For free (almost physical) keys, see my post on xmodmap.
  • See the last post to see how you can get window manipulation commands "for free" when you call ace-window.
  • With hydra, you can define lightweight minor modes for almost free or even completely free key bindings.
  • With lispy, you get list manipulation bindings (single letters, no less) for free when your point is positioned at a list boundary, or when the region is active.
  • With worf, you get heading navigation and manipulation bindings, also single-letter, when your point is at a heading or markup start.

Today, I describe a recent addition to avy: when you call avy-goto-line and decide that you don't want to use avy-keys to select a line on screen, and you want to select a line by number, you can just enter that number.

avy-goto-line will recognize that you entered a digit, and forward to goto-line with that digit already pre-entered. So basically there's no disadvantage to doing this:

(global-set-key (kbd "M-g g") 'avy-goto-line)

Even if you use the avy method zero times, you lose no efficiency when compared with regular goto-line, you just get a pretty light-show with each call:

avy-goto-line.png

You can customize a lot of things in avy, for instance the keys or the way the overlays are displayed. See the new wiki page on customization for more info.