README.md (5621B)
1 [![MELPA](https://melpa.org/packages/avy-badge.svg)](https://melpa.org/#/avy) 2 [![MELPA Stable](https://stable.melpa.org/packages/avy-badge.svg)](https://stable.melpa.org/#/avy) 3 4 ## Introduction 5 6 `avy` is a GNU Emacs package for jumping to visible text using a char-based decision tree. See also [ace-jump-mode](https://github.com/winterTTr/ace-jump-mode) and [vim-easymotion](https://github.com/Lokaltog/vim-easymotion) - `avy` uses the same idea. 7 8 ![logo](https://raw.githubusercontent.com/wiki/abo-abo/avy/images/avy-avatar-1.png) 9 10 ## Command overview 11 12 You can bind some of these useful commands in your config. 13 14 ### `avy-goto-char` 15 16 > Input one char, jump to it with a tree. 17 18 ```elisp 19 (global-set-key (kbd "C-:") 'avy-goto-char) 20 ``` 21 22 After <kbd>C-: b</kbd>: 23 24 ![avy-goto-char](https://raw.githubusercontent.com/wiki/nloyola/avy/images/avy-goto-char.png) 25 26 ### `avy-goto-char-2` 27 28 > Input two consecutive chars, jump to the first one with a tree. 29 30 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. 31 32 ```elisp 33 (global-set-key (kbd "C-'") 'avy-goto-char-2) 34 ``` 35 36 After <kbd>C-' bu</kbd>: 37 38 ![avy-goto-char-2](http://oremacs.com/download/avi-goto-char-2.png) 39 40 ### `avy-goto-char-timer` 41 42 > Input an arbitrary amount of consecutive chars, jump to the first one with a tree. 43 44 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`. As you're inputting characters, you can use `C-h` (backspace) or `DEL` (delete) to 45 forget the last typed character and `RET` to end the input sequence immediately and select a candidate. 46 47 ### `avy-goto-line` 48 49 > Input zero chars, jump to a line start with a tree. 50 51 ```elisp 52 (global-set-key (kbd "M-g f") 'avy-goto-line) 53 ``` 54 55 After <kbd>M-g f</kbd>: 56 57 ![avy-goto-line](http://oremacs.com/download/avi-goto-line.png) 58 59 You can actually replace the <kbd>M-g g</kbd> 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. 60 61 ### `avy-goto-word-1` 62 63 > Input one char at word start, jump to a word start with a tree. 64 65 ```elisp 66 (global-set-key (kbd "M-g w") 'avy-goto-word-1) 67 ``` 68 69 After <kbd>M-g wb</kbd>: 70 71 ![avy-goto-word-1](http://oremacs.com/download/avi-goto-word-1.png) 72 73 ### `avy-goto-word-0` 74 75 > Input zero chars, jump to a word start with a tree. 76 77 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. 78 79 ```elisp 80 (global-set-key (kbd "M-g e") 'avy-goto-word-0) 81 ``` 82 83 After <kbd>M-g e</kbd>: 84 85 ![avy-goto-word-0](http://oremacs.com/download/avi-goto-word-0.png) 86 87 ### Org-mode commands 88 89 * `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. 90 * `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. 91 92 ### Other commands 93 94 There are some more commands which you can explore yourself by looking at the code. 95 96 ### Bindings 97 98 You add this to your config to bind some stuff: 99 100 ```elisp 101 (avy-setup-default) 102 (global-set-key (kbd "C-c C-j") 'avy-resume) 103 ``` 104 105 It will bind, for example, `avy-isearch` to <kbd>C-'</kbd> in `isearch-mode-map`, so that you can select one of the currently visible `isearch` candidates using `avy`. 106 107 ### Customization 108 109 See the comprehensive custom variable list on [the defcustom wiki page](https://github.com/abo-abo/avy/wiki/defcustom). 110 111 See how to write your own avy commands on [the custom-commands wiki page](https://github.com/abo-abo/avy/wiki/custom-commands). 112 113 ## Contributing 114 115 ### Copyright Assignment 116 117 Avy is subject to the same [copyright assignment](http://www.gnu.org/prep/maintain/html_node/Copyright-Papers.html) policy as Emacs itself, org-mode, CEDET and other packages in [GNU ELPA](http://elpa.gnu.org/packages/). Any [legally significant](http://www.gnu.org/prep/maintain/html_node/Legally-Significant.html#Legally-Significant) contributions can only be accepted after the author has completed their paperwork. Please see [the request form](http://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.future) if you want to proceed. 118 119 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). 120 121 ### Style 122 123 The basic code style guide is to use `(setq indent-tabs-mode nil)`. It is provided for you in [.dir-locals.el](https://github.com/abo-abo/avy/blob/master/.dir-locals.el), please obey it. 124 125 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. 126 127 Use your own judgment for the commit messages, I recommend a verbose style using `magit-commit-add-log`.