How to follow a non-linked word corresponding to a note title?

Hello

As the title of this help request is still quite ambiguous, let me illustrate what I try to achieve :

Let’s say I have two notes: one is about Italy and the other is about Rome

In the first paragraph of the Rome note, I describe a few stuffs about this city, and have a sentence like “…Rome is the capital of Italy” where Italy is a roam link to the Italy note. No problem so far.

But then, my Rome note is getting quite long and the word Italy appears a lot of times in multiple paragraphs, headings etc…

It would be quite overkill to link every occurrences of the word Italy to the Italy note. (Also as you know, too many links on a note have a noticeable impact on performance on buffer save.)

So what I would like to do is to craft a specific command, that looks at the current word under the point, searches in the org-roam db if a note with the same title exist, and jump to this note.

This way, as I know that I have a note about Italy, every time is read a note that talks about it, I can quickly jump to it (by activating the aforementioned command by a handy mouse shortcut), even if I haven’t made a proper link beforehand.

Thanks!

Delapouite via Org-roam orgroam@discoursemail.com writes:

[…]

So what I would like to do is to craft a specific command, that looks
at the current word under the point, searches in the org-roam db if a
note with the same title exist, and jump to this note.

If I understand correctly your request, I came up with this command

–8<---------------cut here---------------start------------->8—
(defun konix/org-roam-visit-node-at-point ()
(interactive)
(when-let (node (org-roam-node-from-title-or-alias (word-at-point t)))
(org-roam-node-visit node)))
–8<---------------cut here---------------end--------------->8—

I hope it helps.

5 Likes

Simple and elegant!

Thanks a lot @konubinix