reddit / emacs

My Avy actions customization

artema666 · 2022-02-20 02:41
[https://github.com/xl666/avy-conf/blob/main/avy.org](https://github.com/xl666/avy-conf/blob/main/avy.org) Some months ago I read the excellent article "Avy can do anything ([https://karthinks.com/software/avy-can-do-anything/](https://karthinks.com/software/avy-can-do-anything/)), which changed the way I use Avy and Emacs in general. The article basically explains what are Avy actions and how to create new ones. This got me inspired to create my own Avy actions, which I'd like to share with the community in the form of a literate config. The shared config, extends some notions and creates new ones (some left as a kind-of challenge in the mentioned article): ​ \- Region actions: actions that act in an arbitrary not visible region created with avy selections (copy, yank, kill, teleport). First you mark the initial point of the region with an action, then you execute a region action on the other end of the region. \- Quick char commands: skip the initial filtering step of an Avy command pre-filtering a character. For example I use this in emacs-lisp mode to auto filter open parenthesis with a key binding, this is very useful as actions act on Sexp. \- Auto actions: enable the automatic execution of an avy action on a selected candidate \- Compound actions and commands: link several avy interactions in a single command or action using auto actions. This is useful for example for region actions, instead of executing two Avy commands to first mark the start of the region with a command and then select and act on the end of the region; you only execute a command that integrates two Avy interactions, the first one auto applies the mark action, then you select the action and element at the end of the region. I also use this for creating a replace action, combining kill and yank actions in one action. ​ I hope this results useful for someone.
hmelman · 2022-02-20 03:55
If you don’t know about it, you might be interested in embark.
rswgnu · 2022-02-21 18:27
This use of Avy also sounds like it would make for a perfect integration with GNU Hyperbole which focuses on rapid access and manipulation of information throughout Emacs. Let me know if that is of interest to you.
artema666 · 2022-02-21 21:35
I haven't checked Hyperbole, the only thing I know is that it is a knowledge management system, like org-roam. I will check it out, thanks for the suggestion.