I use epsanso on macOS to do text expansion. It uses a YAML file syntax and can do a lot of really powerful things through scripting. Here’s how I use it to put a breadcrumb trail at the top of my daily notes, which looks like this
[[2020-06-21|<< Yesterday]] | [[2020-06-23|Tomorrow >>]]
# Breadcrumb
- trigger: ":bc"
word: true
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: "echo `date -v -1d \"+[[%Y-%m-%d|<< Yesterday]]\"`' | '`date -v +1d \"+[[%Y-%m-%d|Tommorrow >>]]\"`"
I had to use the shell command date
to automatically generate Yesterday and Tomorrow’s dates.
As a bonus, here is the template I use when tracking meetings
# Meeting
- trigger: ":meet"
word: true
replace: |
## 0000 Meeting
- Tags:
Meeting Link:
Attendees:
Tasks:
Notes:
Obsidian and espanso fight over the bullet markdown tag, so in order to make a bulleted list, you start with one bullet, and then don’t use the bullet tag thingy for the rest of the list.
Edit: More fun!
So my use of Obsidian revolves heavily around Daily Notes. Everything I do links from them and one of the things I’ve kind of wanted was the ability to take thoughts from today and apply them to something I will be working on in the future. The problem is that Daily Notes work off date strings and I hate doing date math in my head. So why not let espanso do it for me?
Below are two examples from my ever expanding espanso config. The first is a dual trigger expansion that creates the link to next Monday’s daily note. I really like the hotkey :>mon
because it helps illustrate time passing in one direction. I use this with Tomorrow (:>1d
) and Yesterday (:<1d
).
Additionally, if I just want to generally schedule something for next week, it also links to next Monday’s daily note, much like the Next Week option Gmail uses for snoozing emails.
# Next Week
- triggers: [ ":>w", ":>mon" ]
word: true
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: "echo `date -v +Mon \"+[[%Y-%m-%d]]\"`"
Note in the date command, the option -v +Mon
forwards to next Monday. I use this in similar triggers. This is one for the upcoming Friday:
# Next Friday
- trigger: ":>fri"
word: true
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: "echo `date -v +Fri \"+[[%Y-%m-%d]]\"`"
This allows me to create links to Daily Notes that haven’t been created yet, and when I finally get there, there will be a backlink to the thing I wanted to work on… and I didn’t have to try and do date math in my head!