
* avy.el (avy-goto-char): (avy-goto-char-2): (avy-goto-word-1): (avy-goto-subword-1): (avy-goto-word-or-subword-1): Update argument list and docstring. * README.md: Add a "Contributing" section. Re #44
4.7 KiB
Introduction
avy
is a GNU Emacs package for jumping to visible text using a char-based decision tree. See also ace-jump-mode and vim-easymotion - avy
uses the same idea.
Command overview
You can bind some of these useful commands in your config.
avy-goto-char
Input one char, jump to it with a tree.
(global-set-key (kbd "π") 'avy-goto-char)
After πb:
avy-goto-char-2
Input two consecutive chars, jump to the first one with a tree.
The advantage over the previous one is less candidates for the tree search. And it's not too inconvenient to enter two consecutive chars instead of one.
(global-set-key (kbd "C-'") 'avy-goto-char-2)
After C-' bu:
avy-goto-line
Input zero chars, jump to a line start with a tree.
(global-set-key (kbd "M-g f") 'avy-goto-line)
After M-g f:
You can actually replace the M-g g binding of goto-line
, since if you enter a digit for avy-goto-line
, it will switch to goto-line
with that digit already entered.
avy-goto-word-1
Input one char at word start, jump to a word start with a tree.
(global-set-key (kbd "M-g w") 'avy-goto-word-1)
After M-g wb:
avy-goto-word-0
Input zero chars, jump to a word start with a tree.
Compared to avy-goto-word-1
, there are a lot more candidates. But at a least there's not need to input the initial char.
(global-set-key (kbd "M-g e") 'avy-goto-word-0)
After M-g e:
Other commands
There are some more commands which you can explore yourself by looking at the code.
Bindings
You add this to your config to bind some stuff:
(avy-setup-default)
It will bind, for example, avy-isearch
to C-' in isearch-mode-map
, so that you can select one of the currently visible isearch
candidates using avy
.
Style customization
There are four styles of overlay functions to choose from. You can choose to use one style for all functions, or you can select a different style for each function. Customize avy-style
and avy-styles-alist
respectively for this.
The styles to choose from:
- pre: the full path will be displayed before target, leaving all original text
- at: the single character path will be displayed on target, obscuring the target
- at-full: the full path will be displayed on target, obscuring the target and the text behind it
- post: the full path will be displayed after target, leaving all original text
At first it seems that pre
and post
are advantageous over at
and at-full
, since you can still see the original text with them. However, they make the text shift a bit. If you don't like that, use either at
or at-full
.
Contributing
Copyright Assignment
Avy is subject to the same copyright assignment policy as Emacs itself, org-mode, CEDET and other packages in GNU ELPA. Any legally significant contributions can only be accepted after the author has completed their paperwork. Please see the request form if you want to proceed.
The copyright assignment isn't a big deal, it just says that the copyright for your submitted changes to Emacs belongs to the FSF. This assignment works for all projects related to Emacs. To obtain it, you need to send one email, then send one letter (if you live in the US, it's digital), and wait for some time (in my case, I had to wait for one month).
Style
The basic code style guide is to use (setq indent-tabs-mode nil)
. It is provided for you in .dir-locals.el, please obey it.
Before submitting the change, run make compile
and make test
to make sure that it doesn't introduce new compile warnings or test failures. Also run M-x checkdoc
to see that your changes obey the documentation guidelines.
Use your own judgment for the commit messages, I recommend a verbose style using magit-commit-add-log
.