org-ref
org-ref copied to clipboard
equivalent of org-ref-cite-insert-ivy for vertico?
Notably because of some performance issues I encountered with ivy, I am currently trying to replace ivy+counsel with vertico+consult. In my init file I currently have (setq org-ref-insert-cite-function 'org-ref-cite-insert-ivy)
, which provides a cool minibuffer citation selection tool.
However, it requires org-ref-ivy
, which (non-surprisingly) ultimately depends on ivy
(through ivy-bibtex
).
Would it be possible to have a functional equivalent of org-ref-cite-insert-ivy
but based on vertico?
pull requests are welcome. You might try the more vanilla inserter (https://github.com/jkitchin/org-ref/blob/master/org-ref-citation-links.el#L1284). This may only use the keys, which isn't that handy. One of the features of ivy-bibtex is it generates the candidates for completion.
I don't know about Vertico, but with consult this is fairly easy to accomplish. It does require an extra package, consult-bibtex
(https://github.com/mohkale/consult-bibtex), which does all the heavy lifting. The following is my glue code to get it to work. It is adapted from the macro consult-bibtex-embark-action
in the consult-bibtex package.
(defun my/org-ref-cite-insert-consult ()
"Insert a citation using `consult-bibtex'."
(interactive)
(let ((key (consult-bibtex--read-entry)))
(if key
(org-ref-insert-cite-key key))))
(setopt org-ref-insert-cite-function 'my/org-ref-cite-insert-consult)
I haven't tested it thoroughly, but I've been using this for a while and haven't had any issues with org-ref-insert-link
.