2025/10/18 - Journal HelperΒΆ
I've made a script that creates a new file for this website journal, with the correct date set up and ready for me to type away.
odonnellrorynew() {
local repo="$HOME/Omni/Basilica/odonnellrory.github.io"
local dir="$repo/docs/00-journal"
local date_str file
if [[ -n "${1:-}" ]]; then
case "$1" in
yesterday) date_str="$(date -d 'yesterday' +%F)" ;;
tomorrow) date_str="$(date -d 'tomorrow' +%F)" ;;
# YYYY-MM-DD
[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]) date_str="$1" ;;
*)
print -u2 "journal: pass YYYY-MM-DD, 'yesterday', or 'tomorrow'"
return 2
;;
esac
else
date_str="$(date +%F)"
fi
mkdir -p -- "$dir"
file="$dir/$date_str.md"
# Create a simple header if it's a new file
if [[ ! -e "$file" ]]; then
{
printf '# %s\n\n' "$(date -d "$date_str" +%Y/%m/%d)"
} > "$file"
fi
cd -- "$repo" || return
nvim -- "$file"
}
It's pretty good.
It can make them for the day before as well by adding "yesterday" to the command.
Now I go into Gnome keyboard shortcuts and make a shortcut, Alt+R, to do alacritty -e zsh -ic odonnellrorynew
And voila. Alt+R creates and opens the latest journal entry for my website, so I can edit it at any time.