diff options
author | David Morgan <djm_uk@protonmail.com> | 2024-10-26 05:50:42 +0100 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2024-10-26 05:50:42 +0100 |
commit | ec4ee61669a88728cc0469c9a310423aefe01769 (patch) | |
tree | d007a56c31ca9c7f676b04ed2bf84d510eedc46f /.emacs.d/lisp | |
parent | 29bb0340b7e1205657423d5a85d8b612298a3152 (diff) | |
download | dotfiles-ec4ee61669a88728cc0469c9a310423aefe01769.tar.gz |
Add consult-recent-xref
Diffstat (limited to '.emacs.d/lisp')
-rw-r--r-- | .emacs.d/lisp/init-minibuffer.el | 24 |
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) |