1 files changed, 23 insertions, 1 deletions
diff --git a/.emacs.d/lisp/init-minibuffer.el b/.emacs.d/lisp/init-minibuffer.el
index 66aabf8..3c8dd99 100644
--- a/.emacs.d/lisp/init-minibuffer.el
+++ b/.emacs.d/lisp/init-minibuffer.el
@@ -496,7 +496,29 @@ See `+become' and the functions that call it (e.g. `+become-consult-line')."
(let ((consult-buffer-sources '(consult--project-source-project-buffer
consult--project-source-project-file-recentf
consult--project-source-project-file-all)))
- (consult-buffer))))
+ (consult-buffer)))
+
+ ;; https://takeonrules.com/2024/06/08/adding-a-consult-function-for-visualizing-xref/
+ (defvar consult--xref-history nil
+ "History for the `consult-recent-xref' results.")
+ (defun consult-recent-xref (&optional markers)
+ "Jump to a marker in MARKERS list (defaults to `xref--history'.
+
+The command supports preview of the currently selected marker position.
+The symbol at point is added to the future history."
+ (interactive)
+ (consult--read
+ (consult--global-mark-candidates
+ (or markers (flatten-list xref--history)))
+ :prompt "Go to Xref: "
+ :annotate (consult--line-prefix)
+ :category 'consult-location
+ :sort nil
+ :require-match t
+ :lookup #'consult--lookup-location
+ :history '(:input consult--xref-history)
+ :add-history (thing-at-point 'symbol)
+ :state (consult--jump-state))))
(use-package consult-flycheck)
|