Find and insert reference to note on macOS using Alfred
Create connections between notes is the essential part of the whole note-taking process, and for sure, it leads to discovering outstanding ideas in the future. However, it requires extra effort during writing: you have to find a proper note, copy the reference and paste it to the original memo. Some software has a built-in feature to handle it, but when it comes to plaintext notes, the implementation depends on the user.
In this article, I’ll show you how to create Alfred workflow that automates the process of finding and inserting a reference to other notes.
First of all, you need to have macOS and app called Alfred. I mentioned Alfred before in my article about running notes. It’s one of the most useful application on my computer.
Why it’s worth to connect notes?
Notes are rarely independent. Like neurons in our brains, they are more powerful if they contain connections to other notes. We can put the reference to different note when we feel, that the particular piece of information is related to another one. For sure, sooner or later, you’ll need a way to create connections between notes.
How to create a reference?
Notes should be long-lasting – that’s why I use plaintext to take them. The most common practice, in this case, is to use a wiki-style syntax to link from one note to another one. Most software, like nvALT, FSNotes or The Archive can parse this tag to create a link to the referenced note. Regardless of how old-school this method is, it’s resistant to time and doesn’t lock you in the specific service or note-taking software.
The reference itself is related to your naming convention. I put a unique DateTime marker as an ID to the name of my note. Thanks to it, I can create a reference using either full name or only ID – whatever is more convenient at the moment.
So to create a reference from one note to another one, I put the id of the referred memo in double-square brackets somewhere in the text of the first one. Here’s an example:
The biggest problem is to find the ID of the note I want to refer to. Without a dedicated feature, you need to change the context of your work, find the proper note, copy the ID and finally insert it into the original note. Let’s Alfred does this work.
Alfred workflow to find and insert reference to note
I created an Alfred workflow to simulate autocompletion of the note reference. You can set your directory for notes, so Alfred will limit the results. Whole workflow looks like below.
The workflow is triggered by a snippet. I use the snippet instead of keyword or hotkey to be able to pass configuration to File Filter and to avoid remembering the next hotkey. Moreover, during working with notes, it’s more natural to write directly in the editor, so the snippet looks like the best option here.
To activate the workflow, type following keys sequence:
\[[. It’s easy to memorize because it looks like the beginning of wiki-style link preceded by a slash, which usually means command in some other software.
The workflow looks for matched markdown files in the pre-configured directory. When you find the note you want to refer to, press Enter to replace snippet with the wiki-style reference. If you’re going to insert the full name of note instead, hold cmd and press Enter.
Before you start, make sure you set the path to your notes directory in environment variables.
Remember to set the notes_directory variable to limit the scope of searching.
I hope you’ll find value in this article. There’s no first time when I take advantage of Alfred to make my work easier. Properly configured and customized, it could be a good partner in your work.
The important takeaway is: you don’t need to use an all-in-one, huge application with tons of features that lock you in its ecosystem. If you can do something manually, you can also automate it on your own! This article responds partially to the post written by Christian on Zettelkasten.de.
The workflow is available in my GitHub’s repository. You can download it from here.
Featured photo by Volodymyr Hryshchenko on Unsplash.