A variable that contains a path


I have a note that serves as my “lab book” where I link to various folders and files of simulation results. I would like to be able to define a variable in that note that is a path (e.g. my_dir = /complicated/long/path/to/a/folder) so it is easier for me to link to stuff, e.g. "See the results [here](file:{my_dir}/figure.png).

Thanks :slight_smile:

If you’re on MacOS, I have a quick and dirty solution:

“System Settings” → “Keyboard” → “Text Replacements…”
Enter your trigger phrase (eg my_dir) under ‘Replace’, and the file path under ‘With’

There isn’t a native equivalent on Windows, but here is a promising program that might add the same functionality

Along those lines, I think a text expander ( I like https://espanso.org/ ) could work well here. Then you could use the same :keyword in all apps.

Thanks guys! These sound like reasonable solutions. On the other hand, I found an unrelated solution which works well for my workflow. When in the finder I use option+cmd+c to copy the absolute path of the file or directory and can then paste it into obsidian.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.