-
Notifications
You must be signed in to change notification settings - Fork 0
wikilink uid
Sean Akahane-Bryen edited this page Jul 28, 2020
·
4 revisions
Inserts a [[wikilink]]
to a note identified using a list search. Given a target note 202007271447 Note Title.txt
, it will output: [[202007271447]]
The macro expects UIDs in the form of 12-digit numbers, and will only recognise notes with such UIDs in their names.
The macro recursively searches a specified directory for any file containing a UID, which need not be notes. (I use it to fetch the UIDs of files outside the Zettelkästen, alongside assign-finder
and open
.)
With thanks to Zettelkasten.de forum users kaidoh and Will for their macros, and Stéphane Chazelas for this StackExchange answer.
#!/usr/bin/env zsh -f
cd "$KMVAR_Instance_Documents_Directory"
# List all files with names containing a string of 12 digits.
print -rC1 -- **/*[:0-9:][:0-9:][:0-9:][:0-9:][:0-9:][:0-9:][:0-9:][:0-9:][:0-9:][:0-9:][:0-9:][:0-9:]*(N-om:t:r)
#!/usr/bin/env zsh -f
# Print the portion of the filename which is a string of 12 digits.
if [[ "$KMVAR_Instance_Target_File" =~ [0-9]{12} ]]; then
echo "$MATCH"
fi
- Folder names containing a dot are mistakenly truncated at the dot.
Version | Date | Changes |
---|---|---|
1.00 | 2020-07-27 | Initial commit |