2021-07-09 20:16:11 +03:00
|
|
|
#+TITLE: completion/vertico
|
2021-07-25 02:33:37 +03:00
|
|
|
#+DATE: July 25, 2021
|
2021-02-16 16:51:03 -06:00
|
|
|
#+SINCE: v3.0.0
|
|
|
|
#+STARTUP: inlineimages
|
|
|
|
|
2021-07-11 20:01:27 +03:00
|
|
|
* Table of Contents :TOC_3:noexport:
|
2021-02-16 16:51:03 -06:00
|
|
|
- [[#description][Description]]
|
2021-07-11 20:01:27 +03:00
|
|
|
- [[#maintainers][Maintainers]]
|
2021-02-16 16:51:03 -06:00
|
|
|
- [[#module-flags][Module Flags]]
|
|
|
|
- [[#plugins][Plugins]]
|
|
|
|
- [[#prerequisites][Prerequisites]]
|
2021-04-10 14:44:27 +03:00
|
|
|
- [[#features][Features]]
|
2021-07-11 20:01:27 +03:00
|
|
|
- [[#vertico-keybindings][Vertico keybindings]]
|
2021-04-10 14:44:27 +03:00
|
|
|
- [[#jump-to-navigation][Jump-to navigation]]
|
|
|
|
- [[#project-search--replace][Project search & replace]]
|
|
|
|
- [[#in-buffer-searching][In-buffer searching]]
|
2021-07-09 19:59:44 +03:00
|
|
|
- [[#vertico-integration-for-various-completing-commands][Vertico integration for various completing commands]]
|
2021-07-11 20:01:27 +03:00
|
|
|
- [[#general][General]]
|
|
|
|
- [[#jump-to-files-buffers-or-projects][Jump to files, buffers or projects]]
|
|
|
|
- [[#search][Search]]
|
|
|
|
- [[#marginalia][Marginalia]]
|
2021-05-08 15:54:27 +03:00
|
|
|
- [[#orderless-filtering][Orderless filtering]]
|
2021-07-11 20:01:27 +03:00
|
|
|
- [[#configuration][Configuration]]
|
2021-02-16 16:51:03 -06:00
|
|
|
|
|
|
|
* Description
|
2021-07-11 20:01:27 +03:00
|
|
|
This module enhances the Emacs search and completion experience, and also
|
|
|
|
provides a united interface for project search and replace, powered by [[https://github.com/BurntSushi/ripgrep/][ripgrep]].
|
2021-02-16 16:51:03 -06:00
|
|
|
|
2021-07-11 20:01:27 +03:00
|
|
|
It does this with several modular packages focused on enhancing the built-in
|
|
|
|
~completing-read~ interface, rather than replacing it with a parallel ecosystem
|
|
|
|
like =ivy= and =helm= do. The primary packages are:
|
|
|
|
|
|
|
|
+ Vertico, which provides the vertical completion user interface
|
|
|
|
+ Consult, which provides a suite of useful commands using ~completing-read~
|
|
|
|
+ Embark, which provides a set of minibuffer actions
|
|
|
|
+ Marginalia, which provides annotations to completion candidates
|
|
|
|
+ Orderless, which provides better filtering methods
|
|
|
|
|
|
|
|
** Maintainers
|
2021-07-25 02:33:37 +03:00
|
|
|
+ @iyefrat
|
2021-02-16 16:51:03 -06:00
|
|
|
|
|
|
|
** Module Flags
|
2021-07-11 20:01:27 +03:00
|
|
|
+ =+icons= Adds icons to =file= and =buffer= category completion selections.
|
2021-02-16 16:51:03 -06:00
|
|
|
|
|
|
|
** Plugins
|
2021-07-11 20:01:27 +03:00
|
|
|
+ [[https://github.com/minad/vertico][vertico]]
|
|
|
|
+ [[https://github.com/minad/consult][consult]]
|
|
|
|
+ [[https://github.com/oantolin/embark/][embark]]
|
|
|
|
+ [[https://github.com/oantolin/embark/][embark-consult]]
|
|
|
|
+ [[https://github.com/minad/marginalia][marginalia]]
|
|
|
|
+ [[https://github.com/oantolin/orderless][orderless]]
|
|
|
|
+ [[https://github.com/mhayashi1120/Emacs-wgrep][wgrep]]
|
|
|
|
+ [[https://github.com/minad/consult/][consult-flycheck]] (=:checkers syntax=)
|
|
|
|
+ [[https://github.com/iyefrat/all-the-icons-completion][all-the-icons-completion]] (=+icons=)
|
2021-02-16 16:51:03 -06:00
|
|
|
|
|
|
|
* Prerequisites
|
|
|
|
This module has no prerequisites.
|
2021-04-10 14:44:27 +03:00
|
|
|
|
|
|
|
* Features
|
|
|
|
|
2021-06-09 18:14:36 +03:00
|
|
|
The packages in this module modify and use the built-in ~completing-read~
|
|
|
|
function, which is used by any function that requires completion. Due to this
|
|
|
|
the full scope of these packages is too large to cover here and you are
|
|
|
|
encouraged to go and read their excellent documentation. We will detail
|
|
|
|
Doom-specific additions:
|
2021-04-10 14:44:27 +03:00
|
|
|
|
2021-07-11 20:01:27 +03:00
|
|
|
** Vertico keybindings
|
|
|
|
When in an active Vertico completion session, the following doom added
|
|
|
|
keybindings are available:
|
|
|
|
|
|
|
|
| Keybind | Description |
|
|
|
|
|-----------------------+----------------------------------------------------|
|
|
|
|
| =C-p= | Go to previous candidate |
|
|
|
|
| =C-n= | Go to next candidate |
|
|
|
|
| =C-k= | (evil) Go to previous candidate |
|
|
|
|
| =C-j= | (evil) Go to next candidate |
|
|
|
|
| =C-;= or =<leader> a= | Open an ~embark-act~ menu to chose a useful action |
|
|
|
|
| =C-c C-;= | export the current candidate list to a buffer |
|
|
|
|
| =C-SPC= | Preview the current candidate |
|
|
|
|
| =C-M-k= | (evil) Go to previous candidate and preview. |
|
|
|
|
| =C-M-j= | (evil) Go to next candidate and preview. |
|
|
|
|
|
|
|
|
~embark-act~ will prompt you with a =which-key= menu with useful commands on the
|
|
|
|
selected candidate or candidate list, depending on the completion category. Note
|
|
|
|
that you can press =C-h= instead of choosing a command to filter through the
|
|
|
|
options with a Vertico buffer, that also has slightly more detailed descriptions
|
|
|
|
due to Marginalia annotations.
|
|
|
|
|
2021-04-10 14:44:27 +03:00
|
|
|
** Jump-to navigation
|
|
|
|
This module provides an interface to navigate within a project using
|
|
|
|
=projectile=:
|
|
|
|
|
2021-07-09 20:16:11 +03:00
|
|
|
https://assets.doomemacs.org/completion/vertico/projectile.png
|
2021-04-10 14:44:27 +03:00
|
|
|
|
|
|
|
| Keybind | Description |
|
|
|
|
|----------------------+-------------------------------------|
|
|
|
|
| =SPC p f=, =SPC SPC= | Jump to file in project |
|
|
|
|
| =SPC f f=, =SPC .= | Jump to file from current directory |
|
|
|
|
| =SPC s i= | Jump to symbol in file |
|
|
|
|
|
|
|
|
** Project search & replace
|
|
|
|
This module provides interactive text search and replace using ripgrep.
|
|
|
|
|
|
|
|
| Keybind | Description |
|
|
|
|
|-----------+--------------------------|
|
|
|
|
| =SPC s p= | Search project |
|
|
|
|
| =SPC s P= | Search another project |
|
|
|
|
| =SPC s d= | Search this directory |
|
|
|
|
| =SPC s D= | Search another directory |
|
|
|
|
|
2021-07-09 20:16:11 +03:00
|
|
|
https://assets.doomemacs.org/completion/vertico/search.png
|
2021-04-10 14:44:27 +03:00
|
|
|
|
|
|
|
Prefixing these keys with the universal argument (=SPC u= for evil users; =C-u=
|
|
|
|
otherwise) changes the behavior of these commands, instructing the underlying
|
|
|
|
search engine to include ignored files.
|
|
|
|
|
|
|
|
This module also provides Ex Commands for evil users:
|
|
|
|
|
|
|
|
| Ex command | Description |
|
|
|
|
|------------------------+------------------------------------------------------------------|
|
|
|
|
| ~:pg[rep][!] [QUERY]~ | Search project (if ~!~, include hidden files) |
|
|
|
|
| ~:pg[rep]d[!] [QUERY]~ | Search from current directory (if ~!~, don't search recursively) |
|
|
|
|
|
|
|
|
The optional `!` is equivalent to the universal argument for the previous
|
|
|
|
commands.
|
|
|
|
|
|
|
|
-----
|
|
|
|
|
2021-07-11 20:01:27 +03:00
|
|
|
On top of the usual Vertico keybindings, search commands also offer support for
|
|
|
|
exporting the current candidate list to an editable buffer =C-c C-e=. After
|
|
|
|
editing the changes can be committed with =C-c C-c= and aborted with =C-c C-k=
|
|
|
|
(alternatively =ZZ= and =ZQ=, for evil users). It uses =wgrep= for grep
|
|
|
|
searches, =wdired= for file searches, and =occur= for buffer searches.
|
2021-04-10 14:44:27 +03:00
|
|
|
|
2021-07-09 20:16:11 +03:00
|
|
|
https://assets.doomemacs.org/completion/vertico/search-replace.png
|
2021-04-10 14:44:27 +03:00
|
|
|
|
2021-06-09 18:14:36 +03:00
|
|
|
** In-buffer searching
|
2021-05-17 15:44:39 +03:00
|
|
|
This module provides some in buffer searching bindings:
|
2021-04-10 14:44:27 +03:00
|
|
|
|
2021-05-17 15:44:39 +03:00
|
|
|
+ =SPC s s= (~isearch~)
|
2021-07-09 20:28:40 +03:00
|
|
|
+ =SPC s S= (~+vertico/search-symbol-at-point~ via ~consult-line~)
|
2021-04-10 14:44:27 +03:00
|
|
|
+ =SPC s b= (~consult-line~)
|
|
|
|
|
2021-07-09 20:16:11 +03:00
|
|
|
https://assets.doomemacs.org/completion/vertico/buffer-search.png
|
2021-04-10 14:44:27 +03:00
|
|
|
|
2021-05-21 13:19:52 +03:00
|
|
|
An ~occur-edit~ buffer can be opened from ~consult-line~ with =C-c C-e=.
|
2021-04-10 14:44:27 +03:00
|
|
|
|
2021-07-09 19:59:44 +03:00
|
|
|
** Vertico integration for various completing commands
|
2021-04-10 14:44:27 +03:00
|
|
|
*** General
|
2021-07-09 19:59:44 +03:00
|
|
|
| Keybind | Description |
|
|
|
|
|----------------+-----------------------------|
|
|
|
|
| =M-x=, =SPC := | Enhanced M-x |
|
|
|
|
| =SPC '= | Resume last Vertico session |
|
2021-04-10 14:44:27 +03:00
|
|
|
|
|
|
|
*** Jump to files, buffers or projects
|
|
|
|
| Keybind | Description |
|
|
|
|
|----------------------+---------------------------------------|
|
|
|
|
| =SPC RET= | Find bookmark |
|
|
|
|
| =SPC f f=, =SPC .= | Browse from current directory |
|
|
|
|
| =SPC p f=, =SPC SPC= | Find file in project |
|
|
|
|
| =SPC f r= | Find recently opened file |
|
|
|
|
| =SPC p p= | Open another project |
|
|
|
|
| =SPC b b=, =SPC ,= | Switch to buffer in current workspace |
|
|
|
|
| =SPC b B=, =SPC <= | Switch to buffer |
|
|
|
|
|
2021-05-21 16:38:54 +03:00
|
|
|
=SPC b b= and =SPC ,= support changing the workspace you're selecting a buffer from
|
|
|
|
via [[https://github.com/minad/consult#narrowing-and-grouping][Consult narrowing]], e.g. if you're on the first workspace, you can switch to
|
|
|
|
selecting a buffer from the third workspace by typing =3 SPC= into the prompt,
|
|
|
|
or the last workspace by typing =0 SPC=.
|
|
|
|
|
|
|
|
=SPC f f= and =SPC .= support exporting to a =wdired= buffer using =C-c C-e=.
|
2021-05-21 13:19:52 +03:00
|
|
|
|
2021-04-10 14:44:27 +03:00
|
|
|
*** Search
|
|
|
|
| Keybind | Description |
|
|
|
|
|-----------+-------------------------------------------|
|
|
|
|
| =SPC p t= | List all TODO/FIXMEs in project |
|
|
|
|
| =SPC s b= | Search the current buffer |
|
|
|
|
| =SPC s d= | Search this directory |
|
|
|
|
| =SPC s D= | Search another directory |
|
|
|
|
| =SPC s i= | Search for symbol in current buffer |
|
|
|
|
| =SPC s p= | Search project |
|
|
|
|
| =SPC s P= | Search another project |
|
|
|
|
| =SPC s s= | Search the current buffer (incrementally) |
|
2021-05-08 15:54:27 +03:00
|
|
|
|
2021-07-11 20:01:27 +03:00
|
|
|
** Marginalia
|
|
|
|
| Keybind | Description |
|
|
|
|
|---------+---------------------------------|
|
|
|
|
| =M-A= | Cycle between annotation levels |
|
|
|
|
|
2021-05-08 15:54:27 +03:00
|
|
|
** Orderless filtering
|
|
|
|
When using orderless to filter through candidates, the default behaviour is for
|
2021-05-20 22:09:41 +03:00
|
|
|
each space separated input to match the candidate as a regular expression or
|
2021-05-17 13:42:45 +03:00
|
|
|
literally.
|
|
|
|
|
2021-06-09 18:14:36 +03:00
|
|
|
Note that due to this style of matching, pressing tab does not expand the input
|
|
|
|
to the longest matching prefix (like shell completion), but rather uses the
|
|
|
|
first matched candidate as input. Filtering further is instead achieved by
|
|
|
|
pressing space and entering another input. In essence, when trying to match
|
|
|
|
=foobar.org=, instead of option 1., use option 2.:
|
|
|
|
|
|
|
|
1. (BAD) Enter =foo TAB=, completes to =foobar.=, enter =org RET=
|
|
|
|
2. (GOOD) Enter =foo SPC org RET=
|
|
|
|
|
2021-05-20 22:09:41 +03:00
|
|
|
Doom has some builtin [[https://github.com/oantolin/orderless#style-dispatchers][style dispatchers]] for more finegrained filtering, which
|
|
|
|
you can use to further specify each space separated input in the following ways:
|
2021-05-16 03:18:13 +03:00
|
|
|
| Input | Description |
|
|
|
|
|------------------+--------------------------------------------|
|
2021-05-20 22:09:41 +03:00
|
|
|
| =!foo= | match without literal input =foo= |
|
2021-05-16 03:18:13 +03:00
|
|
|
| =`bar= or =bar`= | match input =bar= as an initialism |
|
|
|
|
| ==baz= or =baz== | match only with literal input =baz= |
|
|
|
|
| =~qux= or =qux~= | match input =qux= with fuzzy/flex matching |
|
2021-07-11 20:01:27 +03:00
|
|
|
|
|
|
|
* Configuration
|
|
|
|
If you want to further configure this module, here are some good places to start:
|
|
|
|
|
|
|
|
+ Vertico provides several [[https://github.com/minad/vertico#extensions][extentions]] that can be used to extend it's interface
|
|
|
|
+ You can add more Marginalia annotation levels and change the existing ones by
|
|
|
|
editing ~marginalia-annotator-registry~
|
|
|
|
+ You can change the available commands in Embark for category ~$cat~ by editing
|
|
|
|
~embark-$cat-map~, and even add new categories. Note that you add categories
|
|
|
|
by defining them [[https://github.com/minad/marginalia/#adding-custom-annotators-or-classifiers][through marginalia]], and embark picks up on them.
|