2017-04-13 11:35:44 +00:00
|
|
|
#+TITLE: Ivy layer
|
|
|
|
|
2019-05-02 21:49:30 +00:00
|
|
|
#+TAGS: completion|layer
|
|
|
|
|
2019-05-07 20:05:06 +00:00
|
|
|
* Table of Contents :TOC_5_gh:noexport:
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#description][Description]]
|
2017-12-15 16:40:39 +00:00
|
|
|
- [[#features][Features:]]
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#install][Install]]
|
|
|
|
- [[#configuration][Configuration]]
|
2018-01-11 03:19:04 +00:00
|
|
|
- [[#general][General]]
|
|
|
|
- [[#advanced-buffer-information][Advanced buffer information]]
|
2018-12-05 03:03:03 +00:00
|
|
|
- [[#key-bindings][Key bindings]]
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#transient-state][Transient state]]
|
2017-04-13 11:35:44 +00:00
|
|
|
|
|
|
|
* Description
|
2017-04-16 15:10:26 +00:00
|
|
|
This layer enables Ivy for completion. It will replace the default completion by
|
|
|
|
[[https://github.com/emacs-helm/helm][Helm]].
|
2017-04-13 11:35:44 +00:00
|
|
|
|
|
|
|
These completion systems are the central control towers of Spacemacs, they are
|
|
|
|
used to manage buffers, projects, search results, configuration layers, toggles
|
|
|
|
and more...
|
|
|
|
|
|
|
|
Mastering your choice of completion system will make you a Spacemacs power user.
|
|
|
|
|
2017-12-15 16:40:39 +00:00
|
|
|
** Features:
|
|
|
|
- Project wide =grep= like text search via =search-auto=
|
|
|
|
- Project wide text replacements using =counsel-imenu=
|
|
|
|
- Buffer wide dynamic text search via =swiper=
|
|
|
|
- Detailed configuration parameters for ivy appearance
|
|
|
|
- Intuitive =transient state=
|
2018-01-11 03:19:04 +00:00
|
|
|
- Advanced buffer information with =ivy-rich=
|
2017-12-15 16:40:39 +00:00
|
|
|
|
2017-04-13 11:35:44 +00:00
|
|
|
* Install
|
|
|
|
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
|
|
|
|
add =ivy= to the existing =dotspacemacs-configuration-layers= list in this
|
|
|
|
file.
|
|
|
|
|
|
|
|
* Configuration
|
2018-01-11 03:19:04 +00:00
|
|
|
** General
|
2017-04-13 11:35:44 +00:00
|
|
|
You can customize ivy with the following variables:
|
2019-06-01 17:13:30 +00:00
|
|
|
- =ivy-wrap= Whether ~C-n~ and ~C-p~ should wrap-around when at the first or
|
2017-07-29 17:56:56 +00:00
|
|
|
last candidate. The default value is =nil=.
|
2017-04-16 15:10:26 +00:00
|
|
|
- =ivy-extra-directories= Setting this to =nil= hides . and .. directories from
|
|
|
|
file name completion. You can still go up a directory up by ~DEL~.
|
2019-05-26 20:58:52 +00:00
|
|
|
The default value is ("../", "./").
|
2017-04-16 15:10:26 +00:00
|
|
|
- =ivy-use-virtual-buffers= Add bookmarks and recent files to buffer completion
|
|
|
|
menu. The Spacemacs default is t.
|
2017-04-13 11:35:44 +00:00
|
|
|
- =ivy-height= The height of the minibuffer. The Spacemacs default is 15.
|
2017-07-29 17:56:56 +00:00
|
|
|
- =ivy-use-selectable-prompt= When non-nil, make the prompt line selectable like
|
|
|
|
a candidate. The Spacemacs default value is =t=.
|
2018-07-14 19:52:25 +00:00
|
|
|
- =ivy-re-builders-alist= An alist of regex building functions for each
|
|
|
|
collection function. See ivy documentation for possible choices. Use
|
|
|
|
=spacemacs/ivy--regex-plus= instead of =ivy--regex-plus= to get correct
|
|
|
|
highlighting in the search results of =spacemacs/search-project-auto= and
|
|
|
|
similar search commands provided by Spacemacs.
|
2019-05-12 18:31:47 +00:00
|
|
|
- =ivy-ret-visits-directory= Whether ~RET~ and ~C-j~ should be swapped in ivy
|
|
|
|
minibuffer so ~RET~ acts like Ido and descends into directory. It is described
|
|
|
|
[[https://github.com/abo-abo/swiper/wiki/ido-style-folder-navigation][here]] (probably outdated). Default value is =nil=.
|
2017-04-13 11:35:44 +00:00
|
|
|
|
2018-01-11 03:19:04 +00:00
|
|
|
** Advanced buffer information
|
|
|
|
To display more information about buffers set the layer variable
|
|
|
|
=ivy-enable-advanced-buffer-information= to =t= which will enable =ivy-rich=.
|
|
|
|
|
|
|
|
Note that =ivy-rich= has been reported to be very slow on =macOS=. This feature
|
|
|
|
is disabled by default.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq-default dotspacemacs-configuration-layers '(
|
|
|
|
(ivy :variables ivy-enable-advanced-buffer-information t)))
|
|
|
|
#+END_SRC
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
* Key bindings
|
2017-04-16 15:10:26 +00:00
|
|
|
If you choose =ivy= as completion system, make sure to read the [[http://oremacs.com/swiper/][official manual]].
|
2019-05-26 20:58:52 +00:00
|
|
|
In case you don't want to read everything, at least familiarise with
|
2017-04-16 15:10:26 +00:00
|
|
|
[[http://oremacs.com/swiper/#minibuffer-key-bindings][minibuffer key bindings]].
|
|
|
|
|
|
|
|
Some useful key bindings are presented in the following table.
|
2017-04-13 11:35:44 +00:00
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2017-04-13 11:35:44 +00:00
|
|
|
|-------------+------------------------------------------------------------------------------------------------------|
|
|
|
|
| ~RET~ | call default action on current candidate |
|
2019-05-26 20:58:52 +00:00
|
|
|
| ~M-RET~ | the same as ~RET~ but doesn't close completion minibuffer |
|
2017-04-13 11:35:44 +00:00
|
|
|
| ~C-M-j~ | use current input immediately (this can be used to create a new file in Find File) |
|
2019-09-17 12:33:30 +00:00
|
|
|
| ~TAB~ | complete partially |
|
2017-04-13 11:35:44 +00:00
|
|
|
| ~M-o~ | show the list of valid actions on current candidate (then press any of described keys to execute it) |
|
2019-05-26 20:58:52 +00:00
|
|
|
| ~C-M-o~ | the same as ~M-o~ but doesn't close completion minibuffer |
|
2017-04-13 11:35:44 +00:00
|
|
|
| ~C-'~ | use avy to quickly select completion on current page (sometimes faster than using arrows) |
|
|
|
|
| ~<ESC>~ | close minibuffer |
|
2019-09-17 12:33:30 +00:00
|
|
|
| ~C-M-k~ | kill buffer (in =ivy-switch-buffer= (~SPC b b~)) |
|
2017-04-13 11:35:44 +00:00
|
|
|
|
|
|
|
** Transient state
|
|
|
|
Press ~M-SPC~ anytime in Ivy to get into the transient state.
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2017-04-13 11:35:44 +00:00
|
|
|
|-------------+---------------------------------------------------------|
|
|
|
|
| ~j~ | select next candidate |
|
|
|
|
| ~k~ | select previous candidate |
|
|
|
|
| ~d~ | call default action on candidate |
|
2019-05-26 20:58:52 +00:00
|
|
|
| ~g~ | the same as ~d~ but doesn't close completion minibuffer |
|
2017-04-13 11:35:44 +00:00
|
|
|
| ~o~ | leave transient state |
|