2021-02-16 16:51:03 -06:00
|
|
|
#+TITLE: completion/selectrum
|
|
|
|
#+DATE: February 16, 2021
|
|
|
|
#+SINCE: v3.0.0
|
|
|
|
#+STARTUP: inlineimages
|
|
|
|
|
|
|
|
* Table of Contents :TOC_2:noexport:
|
|
|
|
- [[#description][Description]]
|
|
|
|
- [[#module-flags][Module Flags]]
|
|
|
|
- [[#plugins][Plugins]]
|
|
|
|
- [[#prerequisites][Prerequisites]]
|
2021-04-10 14:44:27 +03:00
|
|
|
- [[#features][Features]]
|
|
|
|
- [[#jump-to-navigation][Jump-to navigation]]
|
|
|
|
- [[#project-search--replace][Project search & replace]]
|
|
|
|
- [[#in-buffer-searching][In-buffer searching]]
|
|
|
|
- [[#selectrum-integration-for-various-completing-commands][Selectrum integration for various completing commands]]
|
2021-05-08 15:54:27 +03:00
|
|
|
- [[#orderless-filtering][Orderless filtering]]
|
2021-02-16 16:51:03 -06:00
|
|
|
|
|
|
|
* Description
|
|
|
|
This module provides Selectrum integration for a variety of Emacs commands, as
|
|
|
|
well as a unified interface for project search and replace, powered by ripgrep.
|
|
|
|
|
|
|
|
#+begin_quote
|
|
|
|
TODO
|
|
|
|
#+end_quote
|
|
|
|
|
|
|
|
** Module Flags
|
2021-05-01 14:38:54 +03:00
|
|
|
+ ~+prescient~ Enables prescient filtering and sorting for Selectrum searches
|
|
|
|
instead of orderless.
|
2021-02-16 16:51:03 -06:00
|
|
|
|
|
|
|
** Plugins
|
|
|
|
[[https://github.com/raxod502/selectrum][selectrum]]
|
|
|
|
[[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]]
|
2021-05-01 14:38:54 +03:00
|
|
|
[[https://github.com/oantolin/orderless][orderless]] (unless ~+prescient~)
|
2021-05-07 11:40:55 -05:00
|
|
|
[[https://github.com/mhayashi1120/Emacs-wgrep][wgrep]]
|
2021-05-01 14:38:54 +03:00
|
|
|
[[https://github.com/raxod502/prescient.el][prescient]] (~+prescient~)
|
2021-02-16 16:51:03 -06:00
|
|
|
[[https://github.com/minad/consult/][consult-flycheck]] (~:checkers syntax~)
|
|
|
|
|
|
|
|
* Prerequisites
|
|
|
|
This module has no prerequisites.
|
2021-04-10 14:44:27 +03:00
|
|
|
|
|
|
|
* Features
|
|
|
|
|
|
|
|
Selectrum and friends modify and use the built-in ~completing-read~ function,
|
|
|
|
used by any function that requires completion. Due to this the full scope of
|
|
|
|
these packages is too large to cover here, so we will detail Doom-specific
|
|
|
|
additions:
|
|
|
|
|
|
|
|
** Jump-to navigation
|
|
|
|
This module provides an interface to navigate within a project using
|
|
|
|
=projectile=:
|
|
|
|
|
|
|
|
https://assets.doomemacs.org/completion/selectrum/projectile.png
|
|
|
|
|
|
|
|
| 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 |
|
|
|
|
|
|
|
|
https://assets.doomemacs.org/completion/selectrum/search.png
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
-----
|
|
|
|
|
|
|
|
These keybindings are available while a search is active:
|
|
|
|
|
2021-04-30 01:23:37 +03:00
|
|
|
| Keybind | Description |
|
|
|
|
|-----------+----------------------------------------------------|
|
|
|
|
| =C-o= | Open an ~embark-act~ menu to chose a useful action |
|
|
|
|
| =C-c C-o= | Open a buffer with your search results |
|
|
|
|
| =C-c C-e= | Open a writable buffer of your search results |
|
|
|
|
| =C-SPC= | Preview the current candidate |
|
2021-05-22 01:21:10 +03:00
|
|
|
| =C-M-j= | Scroll down and preview. |
|
|
|
|
| =C-M-k= | Scroll up and preview. |
|
2021-04-30 01:23:37 +03:00
|
|
|
| =C-RET= | Open the selected candidate in other-window |
|
2021-04-10 14:44:27 +03:00
|
|
|
|
|
|
|
Changes to the resulting wgrep buffer (opened by =C-c C-e=) can be committed
|
|
|
|
with =C-c C-c= and aborted with =C-c C-k= (alternatively =ZZ= and =ZQ=, for evil
|
|
|
|
users).
|
|
|
|
|
|
|
|
https://assets.doomemacs.org/completion/selectrum/search-replace.png
|
|
|
|
|
|
|
|
** TODO 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~)
|
|
|
|
+ =SPC s S= (~+selectrum/search-symbol-at-point~ via ~consult-line~)
|
2021-04-10 14:44:27 +03:00
|
|
|
+ =SPC s b= (~consult-line~)
|
|
|
|
|
|
|
|
https://assets.doomemacs.org/completion/selectrum/buffer-search.png
|
|
|
|
|
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
|
|
|
|
|
|
|
** Selectrum integration for various completing commands
|
|
|
|
*** General
|
|
|
|
| Keybind | Description |
|
|
|
|
|----------------+-------------------------------|
|
|
|
|
| =M-x=, =SPC := | Enhanced M-x |
|
|
|
|
| =SPC '= | Resume last Selectrum session |
|
|
|
|
|
|
|
|
*** 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
|
|
|
|
|
|
|
** 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-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 |
|