diff --git a/modules/completion/vertico/autoload/vertico.el b/modules/completion/vertico/autoload/vertico.el index cdd8ce67a..7ea6a47e4 100644 --- a/modules/completion/vertico/autoload/vertico.el +++ b/modules/completion/vertico/autoload/vertico.el @@ -1,28 +1,9 @@ ;;; completion/vertico/autoload/vertico.el -*- lexical-binding: t; -*- -;; To prevent "Unused lexical variable" warning from +vertico--company-capf--candidates-a -;;;###autoload -(defvar orderless-match-faces) - ;; To prevent "Defining as dynamic an already lexical var" from +vertico/embark-preview ;;;###autoload (defvar embark-quit-after-action) -;;;###autoload -(defadvice! +vertico--company-capf--candidates-a (fn &rest args) - "Highlight company matches correctly, and try default completion styles before -orderless." - :around #'company-capf--candidates - (let ((orderless-match-faces [completions-common-part]) - (completion-styles +vertico-company-completion-styles)) - (apply fn args))) - -;;;###autoload -(defadvice! +vertico--consult-recent-file-a (&rest _args) - "`consult-recent-file' needs to have `recentf-mode' on to work correctly" - :before #'consult-recent-file - (recentf-mode +1)) - ;;;###autoload (cl-defun +vertico-file-search (&key query in all-files (recursive t) prompt args) "Conduct a file search using ripgrep. @@ -211,7 +192,7 @@ targets." (if (null keymap) (which-key--hide-popup-ignore-command) (which-key--show-keymap - (if (eq (caar targets) 'embark-become) + (if (eq (plist-get (car targets) :type) 'embark-become) "Become" (format "Act on %s '%s'%s" (plist-get (car targets) :type) @@ -222,7 +203,8 @@ targets." ((and (pred keymapp) km) km) (_ (key-binding prefix 'accept-default))) keymap) - nil nil t)))) + nil nil t (lambda (binding) + (not (string-suffix-p "-argument" (cdr binding)))))))) ;;;###autoload (defun +vertico/crm-select () diff --git a/modules/completion/vertico/config.el b/modules/completion/vertico/config.el index 55dec4678..990d5f36e 100644 --- a/modules/completion/vertico/config.el +++ b/modules/completion/vertico/config.el @@ -28,12 +28,21 @@ overrides `completion-styles' during company completion sessions.") ;; Cleans up path when moving directories with shadowed paths syntax, e.g. ;; cleans ~/foo/bar/// to /, and ~/foo/bar/~/ to ~/. (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy) + (add-hook 'minibuffer-setup-hook #'vertico-repeat-save) (map! :map vertico-map [backspace] #'vertico-directory-delete-char)) (use-package! orderless :after-call doom-first-input-hook :config + (defadvice! +vertico--company-capf--candidates-a (fn &rest args) + "Highlight company matches correctly, and try default completion styles before +orderless." + :around #'company-capf--candidates + (let ((orderless-match-faces [completions-common-part]) + (completion-styles +vertico-company-completion-styles)) + (apply fn args))) + (defun +vertico-orderless-dispatch (pattern _index _total) (cond ;; Ensure $ works with Consult commands, which add disambiguation suffixes @@ -94,6 +103,11 @@ overrides `completion-styles' during company completion sessions.") (advice-add #'completing-read-multiple :override #'consult-completing-read-multiple) (advice-add #'multi-occur :override #'consult-multi-occur) :config + (defadvice! +vertico--consult-recent-file-a (&rest _args) + "`consult-recent-file' needs to have `recentf-mode' on to work correctly" + :before #'consult-recent-file + (recentf-mode +1)) + (setq consult-project-root-function #'doom-project-root consult-narrow-key "<" consult-line-numbers-widen t @@ -112,8 +126,8 @@ overrides `completion-styles' during company completion sessions.") (consult-customize consult-ripgrep consult-git-grep consult-grep consult-bookmark consult-recent-file - +default/search-project +default/search-project-for-symbol-at-point - +default/search-other-project +vertico/search-symbol-at-point + +default/search-project +default/search-other-project + +default/search-project-for-symbol-at-point +default/search-cwd +default/search-other-cwd +default/search-notes-for-symbol-at-point consult--source-file consult--source-project-file consult--source-bookmark @@ -135,6 +149,12 @@ overrides `completion-styles' during company completion sessions.") :desc "Enter candidates" "RET" #'+vertico/crm-exit)) +(use-package! consult-dir + :bind (([remap list-directory] . consult-dir) + :map vertico-map + ("C-x C-d" . consult-dir) + ("C-x C-j" . consult-dir-jump-file))) + (use-package! consult-flycheck :when (featurep! :checkers syntax) :after (consult flycheck)) @@ -155,6 +175,14 @@ overrides `completion-styles' during company completion sessions.") :desc "Actions" "a" #'embark-act)) ; to be moved to :config default if accepted :config (set-popup-rule! "^\\*Embark Export Grep" :size 0.35 :ttl 0 :quit nil) + + (defadvice! +vertico--embark-which-key-prompt-a (fn &rest args) + "Hide the which-key indicator immediately when using the completing-read prompter." + :around #'embark-completing-read-prompter + (which-key--hide-popup-ignore-command) + (let ((embark-indicators + (remq #'embark-which-key-indicator embark-indicators))) + (apply fn args))) (cl-nsubstitute #'+vertico-embark-which-key-indicator #'embark-mixed-indicator embark-indicators) (add-to-list 'embark-indicators #'+vertico-embark-vertico-indicator) ;; add the package! target finder before the file target finder, diff --git a/modules/completion/vertico/packages.el b/modules/completion/vertico/packages.el index 65793d736..aa983772e 100644 --- a/modules/completion/vertico/packages.el +++ b/modules/completion/vertico/packages.el @@ -4,18 +4,19 @@ (package! vertico :recipe (:host github :repo "minad/vertico" :files ("*.el" "extensions/*.el")) - :pin "cd3c400aac2f5435080dc55d13c03c8886241365") + :pin "75f33e36204f8a72d0b8cde81e04d3350a848981") (package! orderless :pin "62f71c34baca0b7d0adeab4a1c07d85ffcee80d9") -(package! consult :pin "166e3b03c3de4f88bbfdeef7f52efac27642e2d3") +(package! consult :pin "57dc1adfdc0feafc71c6f418ff7aa1adbe47a5fd") +(package! consult-dir :pin "08f543ae6acbfc1ffe579ba1d00a5414012d5c0b") (when (featurep! :checkers syntax) (package! consult-flycheck :pin "92b259e6a8ebe6439f67d3d7ffa44b7e64b76478")) -(package! embark :pin "8a0b80c6e6ecdf6bb0df7dc496fe4d03197def65") -(package! embark-consult :pin "8a0b80c6e6ecdf6bb0df7dc496fe4d03197def65") +(package! embark :pin "5b34b2b60370cea5ad9da5931856667a6fae0501") +(package! embark-consult :pin "5b34b2b60370cea5ad9da5931856667a6fae0501") -(package! marginalia :pin "fbd2f378f532b6d34d95d84b43edabd00e99a472") +(package! marginalia :pin "678b6528f3905e624b01daf787461d8c7e06ec0f") (package! wgrep :pin "f9687c28bbc2e84f87a479b6ce04407bb97cfb23")