💾 Archived View for rtr.kalayaan.xyz › blog › 034.gmi captured on 2021-12-03 at 14:04:38. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

../blog.gmi

Making acme work for my gemini blog.

Thu Feb 25 19:14:55 PST 2021

As I have mentioned previously [1], acme really is a good text editor. It allows me to use the full suite of UNIX tools that I have to easily manipulate the text that I am editing. While this is also possible with vim through an extensive use of the .vimrc file. Acme does this on the fly through the use of the native acme functions, mouse buttons and pipes.

As an example, I have made some changes in my blogging workflow to do some of the tedious stuff that I used to do whenever I update my blog. For starters, I use the ``Dump'' command to create a custom window layout for my gemini blogging workflow. Dump allows me to save the current state of my acme session to a text file that can then be loaded on a later date. What I did, therefore, was to just arrange and setup all of the windows, commands and directories in one session and dump that session to a text file. Once done, I only need to load this text file to get back to that session whenever I wanted to update my gemini capsule. Figure 1 shows a picture of my current acme session as I am writing this blog post.

Figure 1. My current acme session.

Another thing that I have done is to make extensive use of the Edit command in acme. Without going into too much detail the Edit command allows me to use sam commands to manipulate text in the current window that I've executed the Edit from. For example, the code:

Edit , s/me/you/g

Changes all instances of the word ``me'' to ``you'' in the current window that I've executed the Edit from. While at a glance it would seem that the Edit command is just handy for substituting and editing text in the current window. It's usage becomes extremely profound once we include the pipe operator ( | ) in our syntax.

Combining Edit with the pipe operator allows me to directly print into the current window that I'm editing the output of a particular command that I've ran. For example, the code:

Edit | date

allows me to print the current date and time on the document that I'm on. In fact, it's what I'm using to produce the datestamps for each of the posts that I've posted in geminispace. Furthermore, you can extend this functionality to print arbitrary text that acme itself produced and put that through a series of pipes the output of which will be printed on the current window that the Edit command was executed from. As such, I was able to write something like this:

=> Edit | 9p read acme/$winid/tag | awk '{ print $1 }' | cut -c 21-33
Edit | u date '+%Y-%m-%d' :
Edit | 9p read acme/$winid/body | u grep '^#' | sed 's/^#//g'

on my template file for my blogposts to generate the gemini link that I have to paste on my blog index. Making an arduous task before just a matter of clicking the middle mouse button now.

[1] 2021-02-12 : On using acme.