Number of watchers on Github | 645 |
Number of open issues | 24 |
Average time to close an issue | 4 days |
Main language | Emacs Lisp |
Average time to merge a PR | about 6 hours |
Open pull requests | 4+ |
Closed pull requests | 26+ |
Last commit | about 1 year ago |
Repo Created | almost 4 years ago |
Repo Last Updated | 11 months ago |
Size | 405 KB |
Organization / Author | abo-abo |
Latest Release | 0.4.0 |
Contributors | 18 |
Page Updated | 2018-03-12 |
Do you use avy? Leave a review! | |
View open issues (24) | |
View avy activity | |
View on github | |
Fresh, new opensource launches 🚀🚀🚀 | |
Trendy new open source projects in your inbox!
View examples
|
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.
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 "C-:") 'avy-goto-char)
After C-: 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-char-timer
Input an arbitrary amount of consecutive chars, jump to the first one with a tree.
This is a more flexible version of avy-goto-char-2
. First part works similarly to isearch
: you type a query and it's highlighted dynamically on the screen. When you stop typing for avy-timeout-seconds
(0.5s by default), you'll be able to select one of the candidates with avy
.
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:
avy-org-goto-heading-timer
: Type part of an Org heading. When you stop typing, if only one heading on the screen matches, it will be jumped to; if more than one matches, you can jump to a heading with Avy. This is like avy-goto-char-timer
but for Org headings.avy-org-refile-as-child
: With point in an entry you want to refile, run this command, select a heading with Avy, and the entry will be refiled as its first child heading. This makes it quick and easy to refile to headings that are visible on-screen, even to other windows or buffers.There are some more commands which you can explore yourself by looking at the code.
You add this to your config to bind some stuff:
(avy-setup-default)
(global-set-key (kbd "C-c C-j") 'avy-resume)
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
.
See the comprehensive custom variable list on the defcustom wiki page.
See how to write your own avy commands on the custom-commands wiki page.
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).
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 make 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
.
Table of Contents
avy-goto-char-timer
obeys avy-styles-alist
de-bruijn
to the defcustom of avy-styles-alist
avy-goto-subword-0
shouldn't offer invisible charscase-fold-search
handlingavy-goto-line
visual-line-mode
avy-background
avy-action
avy-goto-char-timer
avy-all-windows
org-mode
avy-copy-region
org-indent-mode
and visual-line-mode
no catch for tag
point-max
case-fold-search
conditionvisual-line-mode
and bolp
goto-address-mode
avy-keys
avy-pop-mark
avy-goto-line-above
and avy-goto-line-below
avy-line-insert-style
avy-all-windows-alt
avy-subword-extra-word-chars
avy-goto-char-timer
obeys avy-styles-alist
See #67.
de-bruijn
to the defcustom of avy-styles-alist
See #73.
See #76.
avy-goto-subword-0
shouldn't offer invisible charsSee #90.
case-fold-search
handlingSee #87.
See #93.
See #96.
avy-goto-line
See #74.
The old behavior remains for ARG 1 or 4. For all other ARG, simply go to that line. See #86.
visual-line-mode
See #91.
See #91.
avy-background
See #94.
avy-action
See #124.
avy-goto-char-timer
See #97.
See #98.
avy-all-windows
See #104.
org-mode
See #100.
See #128.
avy-copy-region
See #131.
See #108.
org-indent-mode
and visual-line-mode
See #110.
See #111.
Most functions reuse avy--overlay
now.
no catch for tag
See #116.
point-max
See #125.
case-fold-search
conditionSee #126.
visual-line-mode
and bolp
See #129.
goto-address-mode
avy-keys
Now you can set avy-keys also to the arrow keys and page up/down, e.g.
(setq avy-keys '(left right up down prior next))
and those will be displayed as , , , , , in the overlays. The display is controlled by the variable avy-key-to-char-alist
.
See #77.
For example, suppose you have:
(global-set-key (kbd "M-t") 'avy-goto-word-1)
w(e.g. first one on screen):
M-t w a
M-t w na
.M-t w ma
.M-t w xa
.You can customize avy-dispatch-alist
to modify these actions.
See #78.
avy-pop-mark
Goes back to the last location of push-mark
:
avy-goto-line-above
and avy-goto-line-below
See #106.
avy-line-insert-style
Allows to modify the behavior of avy-copy-line
, avy-move-line
, and avy-copy-region
. See #117.
avy-all-windows-alt
Allows to customize the behavior of universal-argument
modifying avy-all-windows
. See #118.
avy-subword-extra-word-chars
Allows to customize the behavior of avy-goto-subword-0
and avy-goto-subword-1
by adding extra chars that should match as word constituents. See #116.
See #27.
at-full
styleSee #5.
at-full
style from shifting text sometimesSee #5.
at-full
interaction with tabsWhen at a tab, visualize it using tab-width
spaces.
See #43.
See #47 and http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20607.
See #63.
avy-goto-char
in README.mdUse C-:
as the new suggested binding instead of the pi char.
See #64.
avy-goto-line
can now break into goto-line
Just enter a digit and you'll be transferred into goto-line
prompt with that digit already entered. This means that you can just bind M-g g
to avy-goto-line
without losing anything.
See #29.
avy-goto-line
now works with all kinds of overlay stylesAny of the following do something different now:
(setq avy-styles-alist
'((avy-goto-line . post)))
(setq avy-styles-alist
'((avy-goto-line . at)))
(setq avy-styles-alist
'((avy-goto-line . at-full)))
(setq avy-styles-alist
'((avy-goto-line . pre)))
See #17.
avy-case-fold-search
Non-nil when searches should ignore case, so e.g. avy-goto-char
b
will match both b
and B
. On by default. Use this to turn off this behavior:
(setq avy-case-fold-search nil)
See #34.
avy-goto-word-or-subword-1
Enter one char, and select a visible word or subword that starts with it, depending on subword-mode
. Move the point there.
See #33.
avy-move-line
should remove empty line after original one is movedSee #40.
avy-move-line
now takes a prefix argUse e.g. M-3
before avy-move-line
to move 3 lines at once.
Example:
(defun avy-goto-lp ()
(interactive)
(avy-goto-char ?\())
This command only goes to the (
character. This is actually very similar to lispy-ace-paren
, except the implementation is only one line.
See #44.
You have to customize avy-all-windows
for this. By default, it's set to work on all windows on the current frame.
To make it work only on the current window, use:
(setq avy-all-windows nil)
To make it work on all frames, use:
(setq avy-all-windows 'all-frames)
avy-goto-char-in-line
This is avy-goto-char
reduced only to the current line. Few candidates means very short decision chars path.
See #49.
de-bruijn
How to use it:
(setq avy-style 'de-bruijn)
What it does: when your leading chars are clumped up together, it's impossible to overlay the decision path without shifting the buffer text a bit. For example, with the word buffer
, you avy-goto-char
b
, and:
fis
aj
fis
ak
It's not possible to overlay 4 characters over ff
in buffer
. But to with de-bruijn
style, which results in the path being aj
and jk
. It's possible to overlay ajk
just fine.
Pros and cons of de-bruijn
over other styles:
avy-ignored-modes
This is meant for visual modes like doc-view-mode
or image-mode
that can have a huge number of chars in a single window. Which results in a huge number of candidates even in other windows.
Current setting:
(setq avy-ignored-modes '(image-mode doc-view-mode pdf-view-mode))
See #57.
See the the custom-commands wiki page and #55.
New variable avy-lead-faces
will determine the faces used to color the current decision depth you're in. For example, if to select a particular candidate you need to press abc
:
awill be highlighted with a face that corresponds to depth 3
bwill be highlighted with a face that corresponds to depth 2
cwill be highlighted with a face that corresponds to depth 1
But if another candidate needs ef
:
ewill be highlighted with a face that corresponds to depth 2
fwill be highlighted with a face that corresponds to depth 1
See #53.
avy-translate-char-function
You can use this, for example, to interpret one character as another in avy-keys
.
Example:
(setq avy-translate-char-function
(lambda (c) (if (= c 32) ?a c)))
This will translate SPC
(32) into a
. So you can press either a
or SPC
to mean a
.
avy-isearch
works for different stylesSee #61.
pre
to at-full
I've come to like at-full
more than pre
over time. The difference is that pre
hides no chars in your buffer, while at-full
doesn't shift text.
Use this to restore the previous default behavior:
(setq avy-style 'pre)
image-mode
and doc-view-mode
buffersregexp-quote
-edavy-background
works better if you're selecting among multiple windowsavy-goto-subword-0
and avy-goto-subword-1
These commands rely on subword
for more precise location of subwords.
avy-setup-default
This is a function call that you can put in your config:
(avy-setup-default)
For now it only binds C-' to avy-isearch
in isearch-mode-map
. It's autoloaded, so you can even omit (require 'avy)
in your config.
avy-goto-char-timer
This is an amalgamation of avy-goto-char
(which uses one narrowing char) and avy-goto-char-2
(which uses two narrowing chars).
If you input two chars quickly (<0.5s by default), the latter is called. Otherwise, the former is called.
You can customize avy-keys
as the all-purpose keys:
(setq avy-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
In addition, you can customize these keys per-command:
(setq avy-keys-alist
`((avy-goto-word-0 .
,(append (number-sequence ?A ?Z)
(number-sequence ?a ?z)))
(avy-goto-word-1 . (?f ?g ?j ?k))))
In this case, avy-goto-word-0
gets 72 decision keys, while avy-goto-word-1
gets only 4, and all others get avy-keys
.
You can customize avy-style
as the all-purpose style (the default is 'pre
):
(setq avy-style 'at-full)
In addition, you can customize the style per-command:
(setq avy-styles-alist
`((avy-goto-char-2 . post)))
I think that 'post
the a style best suited specifically for avy-goto-char-2
since you already type two chars in a sequence, so a third one right after is appropriate. Same for avy-isearch
, that one is always 'post
.
Anything that's prefixed with avi-
is now obsolete. I'll keep the obsolete declarations for around a month, but you should switch before warnings turn into errors. avy-goto-char-style
and avy-goto-word-style
are obsolete as well.