From a61222036988321aebdcb4b81b8fb2b0818f8e80 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Wed, 15 Sep 2021 01:14:49 +0300 Subject: [PATCH] refactor!(vertico): evil minibuffer keybindings BREAKING CHANGE: remove +vertico/(next|previous)-candidate-preview. BREAKING CHANGE: Move vertico-(next|previous)-group to C-M-j/k now that C-S-j/k now default back to scrolling up and down pages. Update docs to reflect these changes. --- modules/completion/vertico/README.org | 10 +++++----- modules/completion/vertico/autoload/vertico.el | 14 -------------- modules/completion/vertico/config.el | 6 ++---- modules/config/default/+evil-bindings.el | 6 ++---- 4 files changed, 9 insertions(+), 27 deletions(-) diff --git a/modules/completion/vertico/README.org b/modules/completion/vertico/README.org index 32621e9ef..ff2c4e3fc 100644 --- a/modules/completion/vertico/README.org +++ b/modules/completion/vertico/README.org @@ -85,11 +85,11 @@ keybindings are available: | =C-n= | Go to next candidate | | =C-k= | (evil) Go to previous candidate | | =C-j= | (evil) Go to next candidate | +| =C-M-k= | (evil) Go to previous group | +| =C-M-j= | (evil) Go to next group | | =C-;= or = 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 @@ -274,9 +274,9 @@ override the module's modifications, do: ;... ) #+end_src -If you are changing the preview keys (set to =C-SPC=, =C-M-j=, and =C-M-k=), -remember to change their bindings on ~vertico-map~ as well, as the bindings -there get previews to work to an extent on non-consult commands as well. +If you are changing the preview key (set to =C-SPC=), remember to change the +binding on ~vertico-map~ as well, as the binding there gets previews to work to +an extent on non-consult commands as well. ** Marginalia You can add more Marginalia annotation levels and change the existing ones by editing ~marginalia-annotator-registry~ diff --git a/modules/completion/vertico/autoload/vertico.el b/modules/completion/vertico/autoload/vertico.el index 51b52c4af..175983747 100644 --- a/modules/completion/vertico/autoload/vertico.el +++ b/modules/completion/vertico/autoload/vertico.el @@ -134,20 +134,6 @@ Supports exporting consult-grep to wgrep, file to wdeired, and consult-location (let ((embark-quit-after-action nil)) (embark-dwim))))) -;;;###autoload -(defun +vertico/next-candidate-preview (&optional n) - "Go forward N candidates and preivew" - (interactive) - (vertico-next (or n 1)) - (+vertico/embark-preview)) - -;;;###autoload -(defun +vertico/previous-candidate-preview (&optional n) - "Go backward N candidates and preivew" - (interactive) - (vertico-previous (or n 1)) - (+vertico/embark-preview)) - (defvar +vertico/find-file-in--history nil) ;;;###autoload (defun +vertico/find-file-in (&optional dir initial) diff --git a/modules/completion/vertico/config.el b/modules/completion/vertico/config.el index ff3f20835..55dec4678 100644 --- a/modules/completion/vertico/config.el +++ b/modules/completion/vertico/config.el @@ -117,12 +117,10 @@ overrides `completion-styles' during company completion sessions.") +default/search-cwd +default/search-other-cwd +default/search-notes-for-symbol-at-point consult--source-file consult--source-project-file consult--source-bookmark - :preview-key (list (kbd "C-SPC") (kbd "C-M-j") (kbd "C-M-k"))) + :preview-key (kbd "C-SPC")) (consult-customize consult-theme - :preview-key - (list (kbd "C-SPC") (kbd "C-M-j") (kbd "C-M-k") - :debounce 0.5 'any)) + :preview-key (list (kbd "C-SPC") :debounce 0.5 'any)) (after! org (defvar +vertico--consult-org-source `(:name "Org" diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index ccb485a49..d48f01832 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -209,11 +209,9 @@ "M-RET" #'vertico-exit-input "C-SPC" #'+vertico/embark-preview "C-j" #'vertico-next - "C-M-j" #'+vertico/next-candidate-preview - "C-S-j" #'vertico-next-group + "C-M-j" #'vertico-next-group "C-k" #'vertico-previous - "C-M-k" #'+vertico/previous-candidate-preview - "C-S-k" #'vertico-previous-group))) + "C-M-k" #'vertico-previous-group))) ;;; :ui