I’m using macOS 12.6 and Hugo v0.104.3 extended. My config file is written in YAML.
I’d like to use an editor with spaces in its name (iA Writer) for the newContentEditor
config option. It appears the space isn’t escaped when running hugo new
, resulting in the following error:
Content "/Users/luke/Developer/lukework/content/blog/2022/10/test/index.md" created
Editing "/Users/luke/Developer/lukework/content/blog/2022/10/test/index.md" 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/index.md]: The file /Users/luke/Developer/lukework/Writer" does not exist.
Of note is the part where it seems to be looking for the file “Writer” in my project root.
I also tested it with Sublime Text and VS Code.
Things I’ve tried/checked:
-
open
is whitelisted in the security config, I’ve been using it with Typora - Tried different escape techniques for the app name: backslash or single/double quotes
- Tried single/double quotes around the entire command, e.g.
newContentEditor: "open -a iA\ Writer"
- Tried aliasing the
open
command + args to a shell alias + reloading shell config (bothzsh
andfish
) - Tried the absolute path for each editor, e.g.
/Applications/iA Writer.app
- Tried the
--editor
flag withhugo new
The open
command works correctly in the terminal:
open -a "iA Writer" foo.md
open -a "iA\ Writer" foo.md
open -a "Visual Studio Code" foo.md
Thanks in advance for any help on this. Let me know if you need more info.