3 With so many of the bloggers I follow talking about the the latest release of MarsEdit[1], I've been getting tooling envy. While my blog[2] is a full-featured enterprise-grade state-of-the-art piece of software, it's not compatible with any of these tools :(. Surely, a lack of appropriate tooling is the real reason why I don't update as often.
5 => https://redsweater.com/marsedit/ [1] MarsEdit
6 => https://git.sr.ht/~rbdr/blog [2] Blog
8 After a dozen misguided minutes of reading the atompub spec[3], I decided to integrate my tooling directly to my editor of choice: `nvim`.
10 => https://datatracker.ietf.org/doc/rfc5023/ [3] The atompub spec
12 Thanks to the marvels of VimScriptâ„¢ I can now add a text file to my blog with `:Blog add`, update the latest post with `:Blog update`, and publish to staging and live with `:Blog stage` and `:Blog publish`. And all it took was a couple of hours of searching how to write commands in vim[4], learning the difference between `<args>` and `<q-args>`, and a ton of sunken cost bias.
14 => https://vimhelp.org/usr_40.txt.html#40.2 [4] How to write commands in vim
16 Here you can see the code in its entirety (with a couple replacements):
20 command -nargs=? Blog :call Blog(<q-args>)
24 let command = get(a:, 1, 0)
25 let path = expand("%:p")
29 echo "This buffer is not a text file"
31 echo "Adding ".path." to blog"
32 call system("blog --add ".path)
37 if command == "update"
39 echo "This buffer is not a text file"
41 echo "Updating ".path." to blog"
42 call system("blog --update ".path)
48 echo "Publishing blog to staging"
49 call system("blog --publish <staging_url>")
53 if command == "publish"
54 echo "Publishing blog"
55 call system("blog --publish <blog_url>")
56 call system("blog --publish-archive <gemini_url>")
61 echo "Available commands:"
62 echo "\tadd\t\tadds current file to blog"
63 echo "\tupdate\t\tupdates latest entry of blog with current file"
64 echo "\tstage\t\tpublish blog to staging"
65 echo "\tpublish\t\tpublish blog to production"
66 echo "\thelp\t\tthis message"
70 echo "Unknown command, run :Blog help for help"
75 Surely, this is all I need to form a publishing habit.
77 Written, published, edited, republished, debugged, and republished with nvim.