I wanted to share my script for setting up my blog.

My idea was to make the setup as frictionless as possible and to increase the likelihood I start writing.

The easiest setup I could think of was going to the terminal and typing blog, and then everything would be ready to go.

So my script (called blog) is as follows:

#!/bin/zsh

tmux new-session -d -s blog
tmux send-keys -t blog:0.0 "zed ~/Codestuff/erngmeblog" C-m
tmux send-keys -t blog:0.0 "cd ~/Codestuff/erngmeblog" C-m
tmux send-keys -t blog:0.0 "open -a "Arc" http://localhost:4000" C-m
tmux send-keys -t blog:0.0 "bundle exec jekyll post "new_post"" C-m
tmux send-keys -t blog:0.0 "bundle exec jekyll serve --livereload --drafts" C-m

And then I ran:

chmod +x blog

which made the script executable. I also put blog in /usr/local/bin so that it was already in $PATH.

Then I run blog in the terminal and everything spins up.

I’m slowly getting addicted to scripting because I did it with another project of mine and it made setup really easy.

There is still some room for improvement: Ideally, it’d immediately split the screen in half as show below, but I could see that being a bit more effort so maybe in the future I’ll tackle that one.

Cricket Update

Screen split in half with blog on the left and Zed (text editor) on the right.

Anyhow, thanks for reading :)