How can I follow org links in the current buffer using ivy? This is similar functionality to m (M-x Info-menu) in info with ivy/counsel installed.

The command should list with ivy everything that org considers a link in the current buffer, and when a link is selected, it should navigate there.

Primarily I want to use this for internal navigation in org-roam, not for browsing to web links. I'm aware that org-roam has its own link navigation functions that uses the org-roam sqlite database, but I want a shorter list of candidates: just those in the current file. When I have something like this, I imagine tweaking it to work for the org-roam backlinks buffer also, but the focus of this question is the general question for org, not org-roam in particular.

  • So you want a function that produces the list of links in the current file?
    – NickD
    Mar 10, 2021 at 13:58
  • Produces that list of links and hooks that up to ivy, yes Mar 11, 2021 at 12:35

1 Answer 1


You might leverage what org-roam does and write a function with a more limited query that gets the current buffer-file-name and limits result by that.

Alternatively, here is an independent approach that might work for you.

(defun follow-buffer-link ()
  (ivy-read "Link: " (org-element-map (org-element-parse-buffer) 'link
               (lambda (lnk)
             (list (org-element-property :raw-link lnk) lnk)))
        :action (lambda (candidate)
            (goto-char (org-element-property :begin (second candidate)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.