Using iA Writer with Hugo

No spaces.

I’m testing out iA Writer for editing Markdown. I’ve been using it on iOS to quickly edit my Obsidian vault, since the Obsidian iOS app has a lot of friction.

On macOS, I ran into an issue with Hugo, the SSG I use for this blog. Hugo’s newContentEditor config option can open a text editor after running the command for starting a new post, hugo new.

With Typora, I had it set up like this:

# config.yaml
newContentEditor: open -a Typora

Replacing Typora with iA Writer threw these errors:

Content "/Users/luke/Developer/lukework/content/blog/2022/10/test/" created
Editing "/Users/luke/Developer/lukework/content/blog/2022/10/test/" with "open" ...
The file /Users/luke/Developer/lukework/Writer" does not exist.
Error: failed to execute binary "
open" with args [-a "iA Writer" /Users/luke/Developer/lukework/content/blog/2022/10/test/]: The file /Users/luke/Developer/lukework/Writer" does not exist.

Escaping the space in the name worked in the terminal, but didn’t work in Hugo:

open -a "iA Writer" 
open -a "iA\ Writer"
open -a "Visual Studio Code"

Looking at the manual for open, you can use the app’s bundle identifier with the -b flag instead. I grabbed iA Writer’s with this command:

codesign -dr - /Applications/iA\

And here’s what my Hugo config looks like now:

# config.yaml
newContentEditor: open -b pro.writer.mac