Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module: add :completion vertico #4664

Merged
merged 147 commits into from
Jul 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
21a8694
add selectrum module
jethrokuan Jan 15, 2021
65c1537
Add selectrum project search
jethrokuan Jan 16, 2021
f4517d8
set prescient things on selectrum-mode
jethrokuan Jan 16, 2021
a0ff8d4
lazy-load embark
jethrokuan Jan 16, 2021
42b3184
feat(selectrum): Add config from Townk's private config
edmundmiller Feb 16, 2021
155f4f6
docs(selectrum): Init README
edmundmiller Feb 16, 2021
a3d7e5c
docs(selectrum): Add temporary TODO file
edmundmiller Feb 16, 2021
63cd309
Bump :completion selectrum
edmundmiller Feb 16, 2021
3afb712
fix(selectrum): Move prescient out of nested use-package
edmundmiller Feb 17, 2021
d760474
fix(selectrum): Move orderless/selectrum config...
edmundmiller Feb 17, 2021
b4e1b21
refactor(selectrum): Move evil bindings where they belong
edmundmiller Feb 17, 2021
baa5b8f
fix(selectrum): Use jcf +selectrum-file-search
edmundmiller Feb 17, 2021
b741d6a
fix(selectrum): Remove unnecessary advice overrides
edmundmiller Feb 17, 2021
a23a966
Update modules/completion/selectrum/TODO.org
edmundmiller Feb 17, 2021
5b70b88
feat(selectrum): Add selectrum-repeat binding
edmundmiller Feb 17, 2021
d47f0d6
feat(selectrum): Set window height to match ivy
edmundmiller Feb 18, 2021
09845be
feat(selectrum): Add Search buffer binding
iyefrat Apr 9, 2021
bc13b4a
feat(selectrum): Add bookmark command
edmundmiller Feb 19, 2021
a1293a0
feat(selectrum): Add consult-mark
edmundmiller Feb 19, 2021
5216ba4
style(selectrum): Alphabetize and align binds
edmundmiller Feb 19, 2021
dfce5dd
feat(selectrum): Add +selectrum/search-symbol-at-point
edmundmiller Feb 20, 2021
74b100c
fix(selectrum): Apply changes from minad's review
edmundmiller Feb 21, 2021
4fb1b7e
fix(selectrum): Tear +selectrum-file-search down to consult-ripgrep
edmundmiller Feb 22, 2021
da75da3
fix(selectrum): Revert to jethro's version of file-search
edmundmiller Feb 24, 2021
deed316
fix(selectrum): Set max window height to 17
edmundmiller Mar 7, 2021
261927e
add orderless style dispatchers
bdarcus Apr 2, 2021
54cf600
Bump :completion selectrum
bdarcus Apr 2, 2021
7ba1cc6
selectrum: add init.el witticism
iyefrat Apr 5, 2021
02d4b7d
selectrum: add features section to README
iyefrat Apr 10, 2021
8eec594
selectrum: update TODO.org
iyefrat Apr 10, 2021
d1f2414
Bump :completion selectrum
iyefrat Apr 10, 2021
4aaf7e5
selectrum: fix +selectrum-file-search
iyefrat Apr 10, 2021
1d43c73
selectrum: fix marginalia not loading on +prescient
iyefrat Apr 10, 2021
3c55105
selectrum: annotate persp-switch-to-buffer
iyefrat Apr 10, 2021
7507214
selectrum: add consult-lsp
iyefrat Apr 25, 2021
93008e1
Bump :completion selectrum
iyefrat Apr 25, 2021
1b74d82
selectrum: orderless now works
iyefrat Apr 25, 2021
dc5442f
selectrum: consult-recent-files now works on startup
iyefrat Apr 25, 2021
55e4afa
selectrum: update TODO.org
iyefrat Apr 25, 2021
0cdc7ec
Add selectrum branch for SPC-* symbol search
Apr 27, 2021
a51c039
Set up consult-xref if selectrum is enabled
Apr 27, 2021
2cae745
selectrum: deactivate slow consult previews
iyefrat Apr 26, 2021
7e51f98
selectrum: add C-SPC binding (half works)
iyefrat Apr 26, 2021
a3c978b
selectrum: add bibtex-actions to tools/biblio
iyefrat Apr 28, 2021
b9e3483
selectrum: update bindings
iyefrat Apr 29, 2021
8e63717
selectrum: add spellcheck support
iyefrat Apr 29, 2021
0e9864d
selectrum: fix project switching with workspaces
iyefrat Apr 29, 2021
e8dc511
selectrum: move consult-lsp to :tools lsp
iyefrat Apr 29, 2021
7ec7134
selectrum: improve ivy parity
iyefrat Apr 29, 2021
ff9a15e
selectrum: rework live-previews
iyefrat Apr 29, 2021
f532bfe
selectrum: document embark-act binding
iyefrat Apr 29, 2021
19c0744
selectrum: Replace obsolete selectrum-active-p
jcf Apr 16, 2021
e181318
Setup consult as completion-in-region fallback
gagbo May 1, 2021
6dfc324
selectrum: improve file category commands...
iyefrat May 1, 2021
c1cbfa0
selectrum: use orderless by default
iyefrat May 1, 2021
56d6dc5
selectrum: refactor orderless configuration
iyefrat May 1, 2021
52cae6e
Bump bibtex-actions
iyefrat May 1, 2021
b9757e7
selectrum: update bibtex-actions config
iyefrat May 1, 2021
b2af88a
Bump :completion selectrum
iyefrat May 2, 2021
02cf4bf
selectrum: regorganize TODO.org
iyefrat May 2, 2021
fa527c0
selectrum: fix project search evil command autoloads
iyefrat May 3, 2021
53e4e8c
selectrum: refactor orderless use-package
iyefrat May 4, 2021
51a9a62
selectrum: eagerly load embark
iyefrat May 5, 2021
3413433
feat(selectrum): Add wgrep
edmundmiller May 7, 2021
8957f02
selectrum: improve wgrep
iyefrat May 7, 2021
34bc993
selectrum: remove marginalia-annotators
iyefrat May 8, 2021
1266ac7
selectrum: document orderless style dispatchers
iyefrat May 8, 2021
26a310d
selectrum: improve ivy parity
iyefrat May 8, 2021
693eb3c
selectrum: add +irc/selectrum-jump-to-channel
iyefrat May 8, 2021
1fe0ad3
selectrum: improve :tools lookup integration
iyefrat May 8, 2021
f372f3a
selectrum: reorganize consult use-package!
iyefrat May 15, 2021
4e74a22
selectrum: rework consult previews
iyefrat May 15, 2021
2945d2d
Bump :completion selectrum
iyefrat May 16, 2021
5656e39
selectrum: rework orderless style dispatchers
iyefrat May 16, 2021
e2f1783
selectrum: pass target to `embark-action-indicator`
iyefrat May 16, 2021
23b4dfa
selectrum: document bugs in TODO.org
iyefrat May 16, 2021
157a6c5
selectrum: partially fix selectrum-repeat issue
iyefrat May 17, 2021
c349a0a
selectrum: remove automatic initialisms for M-x etc
iyefrat May 17, 2021
ed922a6
selectrum: improve bindings
iyefrat May 17, 2021
5f12afc
:tools lsp update readme to include consult-lsp
iyefrat May 17, 2021
2868177
Bump :completion selectrum
iyefrat May 17, 2021
a52b9cf
selectrum: change embark-consult-preview-at-point...
iyefrat May 17, 2021
23a47ac
selectrum: set manual preview to all grep variants
iyefrat May 18, 2021
49a5c51
selectrum: fix bugs when counsel is loaded (hack)
iyefrat May 20, 2021
24f2efd
selectrum: refactor +irc/selectrum-jump-to-channel
iyefrat May 21, 2021
747f1e3
selectrum: update TODO.org
iyefrat May 20, 2021
308c679
selectrum: drop foo! orderless style dispatch
iyefrat May 20, 2021
436794a
Bump :completion selectrum
iyefrat May 20, 2021
85be335
selectrum: simplify +selectrum/embark-wgrep
iyefrat May 20, 2021
23a63ba
selectrum: generalize +selectrum/embark-wgrep
iyefrat May 21, 2021
188fc09
selectrum: improve SPC b b
iyefrat May 21, 2021
89fd6b6
selectrum: add preview to non-consult functions
iyefrat May 21, 2021
1f32817
Bump :completion selectrum
iyefrat May 21, 2021
14d6613
selectrum: refactor consult stuff
iyefrat May 22, 2021
ed283c6
selectrum: make workspace source number consistent
iyefrat May 23, 2021
36faa0c
selectrum: bind embark-act to SPC a and C-;...
iyefrat May 23, 2021
f29f6be
selectrum: embark changes...
iyefrat May 23, 2021
f136521
selectrum: sudo-edit -> doom/sudo-find-file...
iyefrat May 25, 2021
59ca618
Bump :completion selectrum
iyefrat May 25, 2021
4359d96
selectrum: use consult-customize for preview keys
iyefrat May 25, 2021
8c75e07
selectrum: reorganize keybinding locations
iyefrat May 29, 2021
8aea99c
selectrum: rework setq's for selectrum use-package
iyefrat May 29, 2021
e5f3166
selectrum: add embark target for package! statements
iyefrat May 31, 2021
e5e75e8
selectrum: override embark-package-map with doom...
iyefrat May 31, 2021
c056e71
selectrum: don't override embark-target-finders...
iyefrat Jun 1, 2021
ebd72b7
selectrum: remove some bindings
iyefrat Jun 6, 2021
540c523
Selectrum: add embark action to open file in new workspace
ymarco Jun 8, 2021
573bd73
selectrum: annotate more functions
iyefrat Jun 2, 2021
fad34eb
selectrum: README changes, TODO overhaul...
iyefrat Jun 9, 2021
f315a60
Bump :completion selectrum
iyefrat Jun 16, 2021
5a44c1f
selectrum: remove side effect in irc jump function
iyefrat Jun 18, 2021
53e2c32
Bump consult-lsp
iyefrat Jun 29, 2021
3283acb
selectrum: use default values for consult async timers
iyefrat Jun 29, 2021
83abd71
selectrum: update TODO, add docs/modules.org entry
iyefrat Jun 29, 2021
336ad46
selectrum: clean up selectrum config
iyefrat Jun 30, 2021
7c313fb
selectrum: autoload +selectrum/backward-updir...
iyefrat Jun 30, 2021
2e6a04e
selectrum: remove embark export/collect popup rules
iyefrat Jun 30, 2021
78955d8
selectrum: add preview debounce for consult-theme
iyefrat Jul 1, 2021
d3eff82
selectrum: add experimental vertico flag
iyefrat Jun 30, 2021
e65dffd
selectrum: remove `selectrum-minibuffer-map` from...
iyefrat Jul 2, 2021
92586ca
selectrum: remove `doom-project-find-file` hack
iyefrat Jul 2, 2021
d86375a
selectrum: add icon support
iyefrat Jul 4, 2021
814c5b5
selectrum: improve company advice
iyefrat Jul 6, 2021
bc9d2bf
selectrum: better `completion-in-region-function`
iyefrat Jul 6, 2021
debba41
Bump :completion selectrum
iyefrat Jul 9, 2021
29c49f7
selectrum: use `consult-completing-read-multiple`
iyefrat Jul 9, 2021
794b8c2
selectrum: add `vertico-repeat` support
iyefrat Jul 9, 2021
dc6da58
selectrum: fix false positive marginalia annotation...
iyefrat Jul 9, 2021
f9e1c99
completion/selectrum -> completion/vertico, part 1
iyefrat Jul 9, 2021
24eaa13
completion/selectrum -> completion/vertico, part 2
iyefrat Jul 9, 2021
a0eb4e9
completion/selectrum -> completion/vertico, part 3
iyefrat Jul 9, 2021
34f8e1f
vertico: Improve README and update TODO...
iyefrat Jul 11, 2021
41e657f
vertico: remove `:demand t` from `use-package`'s
iyefrat Jul 13, 2021
f8a64c8
vertico: pass universal argument from vertico...
iyefrat Jul 13, 2021
099f851
vertico: add consult buffer source for org buffers
iyefrat Jul 13, 2021
21b91e5
Bump :completion vertico
iyefrat Jul 18, 2021
d0f4c5f
vertico: use `all-the-icons-completion-marginalia-setup`
iyefrat Jul 18, 2021
29bd530
vertico: use `vertico-directory-tidy`
iyefrat Jul 18, 2021
770084f
vertico: use consult-line in +default/search-buffer
iyefrat Jul 24, 2021
3f10167
vertico: various refactors...
iyefrat Jul 24, 2021
c12fb64
vertico: defer loading of embark and orderless
iyefrat Jul 24, 2021
a4093e9
vertico: fix unused lexical variable error
iyefrat Jul 24, 2021
a0e384f
Bump :completion vertico
iyefrat Jul 24, 2021
f94b985
Bump :tools biblio
iyefrat Jul 24, 2021
aff25b1
Bump :checkers spell
iyefrat Jul 24, 2021
e2cd827
vertico: add variable to set company completion styles
iyefrat Jul 24, 2021
beb0b44
vertico: prepare for merge...
iyefrat Jul 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/autoload/help.el
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ will be automatically appended to the result."
#'+ivy-file-search)
((fboundp '+helm-file-search)
#'+helm-file-search)
((fboundp '+vertico-file-search)
#'+vertico-file-search)
((rgrep
(read-regexp
"Search for" (or initial-input 'grep-tag-default)
Expand Down
6 changes: 4 additions & 2 deletions core/autoload/projects.el
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,13 @@ If DIR is not a project, it will be indexed (but not cached)."
(if (doom-module-p :completion 'ivy)
#'counsel-projectile-find-file
#'projectile-find-file)))
((fboundp 'counsel-file-jump) ; ivy only
((and (bound-and-true-p ivy-mode)
(fboundp 'counsel-file-jump))
(call-interactively #'counsel-file-jump))
((project-current nil dir)
(project-find-file-in nil nil dir))
((fboundp 'helm-find-files)
((and (bound-and-true-p helm-mode)
(fboundp 'helm-find-files))
(call-interactively #'helm-find-files))
((call-interactively #'find-file)))))

Expand Down
1 change: 1 addition & 0 deletions docs/modules.org
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ completion.
+ helm =+fuzzy +childframe= - *Another* search engine for love and life
+ ido - The /other/ *other* search engine for love and life
+ [[file:../modules/completion/ivy/README.org][ivy]] =+fuzzy +prescient +childframe +icons= - /The/ search engine for love and life
+ [[file:../modules/completion/vertico/README.org][vertico]] =+icons= - The search engine of the future

* :config
Modules that configure Emacs one way or another, or focus on making it easier
Expand Down
1 change: 1 addition & 0 deletions init.example.el
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
;;helm ; the *other* search engine for love and life
;;ido ; the other *other* search engine...
ivy ; a search engine for love and life
;;vertico ; the search engine of the future

:ui
;;deft ; notational velocity for Emacs
Expand Down
15 changes: 13 additions & 2 deletions modules/app/irc/autoload/irc.el
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,19 @@ workspace for it."
argument) is non-nil only show channels in current server."
(interactive "P")
(call-interactively
(cond ((featurep! :completion ivy) #'+irc/ivy-jump-to-channel)
((user-error "No jump-to-channel backend is enabled. Enable ivy!")))))
(cond ((featurep! :completion ivy) #'+irc/ivy-jump-to-channel)
((featurep! :completion vertico) #'+irc/vertico-jump-to-channel)
((user-error "No jump-to-channel backend is enabled. Enable vertico or ivy!")))))

;;;###autoload
(defun +irc--circe-all-buffers ()
(cl-loop with servers = (circe-server-buffers)
for server in servers
collect server
nconc
(with-current-buffer server
(cl-loop for buf in (circe-server-chat-buffers)
collect buf))))

;;;###autoload
(defun +irc/tracking-next-buffer ()
Expand Down
23 changes: 23 additions & 0 deletions modules/app/irc/autoload/vertico.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
;;; app/irc/autoload/vertico.el -*- lexical-binding: t; -*-
;;;###if (featurep! :completion vertico)

;;;###autoload
(defun +irc/vertico-jump-to-channel ()
"Jump to an open channel or server buffer with vertico."
(interactive)
(require 'consult)
(consult--multi (list (plist-put (copy-sequence +irc--consult-circe-source)
:hidden nil))
:narrow nil
:require-match t
:prompt "Jump to:"
:sort nil))

;;;###autoload
(defvar +irc--consult-circe-source
`(:name "circe"
:hidden t
:narrow ?c
:category buffer
:state ,#'consult--buffer-state
:items ,(lambda () (mapcar #'buffer-name (+irc--circe-all-buffers)))))
4 changes: 4 additions & 0 deletions modules/app/irc/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ playback.")
;; Fail gracefully if not in a circe buffer
(global-set-key [remap tracking-next-buffer] #'+irc/tracking-next-buffer)

(when (featurep! :completion vertico)
(after! consult
(add-to-list 'consult-buffer-sources '+irc--consult-circe-source 'append)))

(map! :localleader
(:map circe-mode-map
"a" #'tracking-next-buffer
Expand Down
2 changes: 1 addition & 1 deletion modules/checkers/spell/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ This module has no dedicated maintainers.
+ [[https://github.com/d12frosted/flyspell-correct][flyspell-correct]]
+ [[https://github.com/d12frosted/flyspell-correct#flyspell-correct-ivy-interface][flyspell-correct-ivy]] (=completion/ivy=)
+ [[https://github.com/d12frosted/flyspell-correct#flyspell-correct-helm-interface][flyspell-correct-helm]] (=completion/helm=)
+ [[https://github.com/d12frosted/flyspell-correct#flyspell-correct-popup-interface][flyspell-correct-popup]] (if *neither* =completion/ivy= or =completion/helm=)
+ [[https://github.com/d12frosted/flyspell-correct#flyspell-correct-popup-interface][flyspell-correct-popup]] (if *neither* =completion/ivy=, =completion/helm= or =completion/vertico=)
+ [[https://github.com/rolandwalker/flyspell-lazy][flyspell-lazy]]
+ else
+ [[https://gitlab.com/ideasman42/emacs-spell-fu][spell-fu]]
Expand Down
3 changes: 2 additions & 1 deletion modules/checkers/spell/autoload/+spell-fu.el
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
(save-current-buffer
(ispell-accept-buffer-local-defs))
(if (not (or (featurep! :completion ivy)
(featurep! :completion helm)))
(featurep! :completion helm)
(featurep! :completion vertico)))
(call-interactively #'ispell-word)
(cl-destructuring-bind (start . end)
(or (bounds-of-thing-at-point 'word)
Expand Down
3 changes: 2 additions & 1 deletion modules/checkers/spell/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ e.g. proselint and langtool."
(require 'flyspell-correct-helm nil t)))
((and (featurep! :completion ivy)
(require 'flyspell-correct-ivy nil t)))
((require 'flyspell-correct-popup nil t)
((featurep! :completion vertico)) ; vertico doesn't need any extra configuration
((require 'flyspell-correct-popup nil t) ; only use popup if no compatible completion UI is enabled
(setq flyspell-popup-correct-delay 0.8)
(define-key popup-menu-keymap [escape] #'keyboard-quit))))

Expand Down
5 changes: 3 additions & 2 deletions modules/checkers/spell/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

(if (not (featurep! +flyspell))
(package! spell-fu :pin "1abcb5594e1bfe35716d29e64523e4cebdce737c")
(package! flyspell-correct :pin "404233604439117301562deadc952fe82cb02120")
(package! flyspell-correct :pin "00357953a736e21d0a1c8d76f5605820990544fe")
(cond ((featurep! :completion ivy)
(package! flyspell-correct-ivy))
((featurep! :completion helm)
(package! flyspell-correct-helm))
((package! flyspell-correct-popup)))
((not (featurep! :completion vertico))
(package! flyspell-correct-popup)))
(package! flyspell-lazy :pin "0fc5996bcee20b46cbd227ae948d343c3bef7339"))
221 changes: 221 additions & 0 deletions modules/completion/vertico/README.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
#+TITLE: completion/vertico
#+DATE: July 25, 2021
#+SINCE: v3.0.0
#+STARTUP: inlineimages

* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
- [[#maintainers][Maintainers]]
- [[#module-flags][Module Flags]]
- [[#plugins][Plugins]]
- [[#prerequisites][Prerequisites]]
- [[#features][Features]]
- [[#vertico-keybindings][Vertico keybindings]]
- [[#jump-to-navigation][Jump-to navigation]]
- [[#project-search--replace][Project search & replace]]
- [[#in-buffer-searching][In-buffer searching]]
- [[#vertico-integration-for-various-completing-commands][Vertico integration for various completing commands]]
- [[#general][General]]
- [[#jump-to-files-buffers-or-projects][Jump to files, buffers or projects]]
- [[#search][Search]]
- [[#marginalia][Marginalia]]
- [[#orderless-filtering][Orderless filtering]]
- [[#configuration][Configuration]]

* Description
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]].

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
+ @iyefrat

** Module Flags
+ =+icons= Adds icons to =file= and =buffer= category completion selections.

** Plugins
+ [[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=)

* Prerequisites
This module has no prerequisites.

* Features

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:

** 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.

** Jump-to navigation
This module provides an interface to navigate within a project using
=projectile=:

https://assets.doomemacs.org/completion/vertico/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/vertico/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.

-----

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.

https://assets.doomemacs.org/completion/vertico/search-replace.png

** In-buffer searching
This module provides some in buffer searching bindings:

+ =SPC s s= (~isearch~)
+ =SPC s S= (~+vertico/search-symbol-at-point~ via ~consult-line~)
+ =SPC s b= (~consult-line~)

https://assets.doomemacs.org/completion/vertico/buffer-search.png

An ~occur-edit~ buffer can be opened from ~consult-line~ with =C-c C-e=.

** Vertico integration for various completing commands
*** General
| Keybind | Description |
|----------------+-----------------------------|
| =M-x=, =SPC := | Enhanced M-x |
| =SPC '= | Resume last Vertico 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 |

=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=.

*** 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) |

** Marginalia
| Keybind | Description |
|---------+---------------------------------|
| =M-A= | Cycle between annotation levels |

** Orderless filtering
When using orderless to filter through candidates, the default behaviour is for
each space separated input to match the candidate as a regular expression or
literally.

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=

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:
| Input | Description |
|------------------+--------------------------------------------|
| =!foo= | match without literal input =foo= |
| =`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 |

* 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.
14 changes: 14 additions & 0 deletions modules/completion/vertico/autoload/evil.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
;; completion/vertico/autoload/evil.el -*- lexical-binding: t; -*-
;;;###if (featurep! :editor evil)

;;;###autoload (autoload '+vertico:project-search "completion/vertico/autoload/evil" nil t)
(evil-define-command +vertico:project-search (query &optional all-files-p)
"Ex interface for `+vertico/project-search'."
(interactive "<a><!>")
(+vertico/project-search all-files-p query))

;;;###autoload (autoload '+vertico:project-search-from-cwd "completion/vertico/autoload/evil" nil t)
(evil-define-command +vertico:project-search-from-cwd (query &optional recurse-p)
"Ex interface for `+vertico/project-search-from-cwd'."
(interactive "<a><!>")
(+vertico/project-search-from-cwd (not recurse-p) query))
Loading