In case it’s useful to anyone else, here is my substitution command for converting a “regular Scripture reference” to a wiki link Scripture reference using vim
:
:%s/\v( ?[1-3]? [A-Z][a-z]*) ([0-9][0-9]?[0-9]?:[0-9][0-9]?-?[0-9]?[0-9]?)/ [[\1#\2]]/g
The above will sometimes leave an extra space after the opening [[
so then I run this to remove that:
:%s/\[\[ /[[/g
I typically run this while editing multiple files, something like vim notes/*.md
and then use bufdo to run the substitutions on all the files at once and save to disk.
:bufdo execute '%s/\v( ?[1-3]? [A-Z][a-z]*) ([0-9][0-9]?[0-9]?:[0-9][0-9]?-?[0-9]?[0-9]?)/ [[\1#\2]]/g' | update
and then:
:bufdo execute ':%s/\[\[ /[[/g' | update
For reference, the above turns text like this:
Paul refers to Genesis 15:6 in Galatians 3:6.
1 John 4:5 and 2 Chronicles 7:11 and also Psalm 119:9-11
into text like this:
Paul refers to [[Genesis#15:6]] in [[Galatians#3:6]].
[[1 John#4:5]] and [[2 Chronicles#7:11]] and also [[Psalm#119:9-11]].
Of course, if you use a similar reference syntax for anything else the above commands will convert them as well. It does not convert Galatians 4
or Galatians
.
To round out the setup I have, I’m using 1 file per book for Scripture, like this:
Ephesians
Chapter 1
Paul Addresses The Ephesians
1:1
Paul, an apostle of Christ Jesus by the will of God,
To the saints who are in Ephesus, and are faithful in Christ Jesus:
1:2
Grace to you and peace from God our Father and the Lord Jesus Christ.
Overall, this is really suiting my use case, which is mostly speaking notes with references into my mobile app while studying Scripture. These are pushed into a private Github repository which Obsidian then pulls down on startup. I think the next step for me is to automate the reference conversion, maybe via a git hook on my repository so that the references get linkified before a commit.