Software and Computer Engineering

Daily Journaling with vim, git and shell scripting

I got a simple journaling scheme set up on my shell that I think that I will be sticking with going forward. It is based in two aliases:

# journaling

alias j='( cd ~/ \
    && vim journal/$(date -I).md )'

alias gcj='( cd ~/ \
    && git add journal \
    && git commit -m "journal: $(date -I)" \
    && git pull && git push )'

NOTE: These aliases assume that is a git repository located at the user's home directory ~.

What does using it look like?

I first get the feeling I want to jot down some thoughts on my journal. After that, I open up the terminal and press j and Enter, which triggers the first alias and puts me into vim in today's journal entry.

When I'm done with editing the entry, I save the file in vim and run the gcj alias, which commits and pushes the latest state of the journal to a remote machine in a VM.

Why is it cool?

First of all, it is as frictionless as possible. I want to get from “thought” to “recorded” in a few steps, since I know that if I don't make it easy for myself to do it, I won't do it (or I will do it less frequently).

The shell alias, by typing in a single character, encodes the whole process of opening vim at today's journal entry by nicely composing some command-line utilities.

Why this and not paper?

I trust myself to keep this single git repository properly backed-up and available on all my devices and platforms, but with a paper notebook I'd have to remind myself to bring it wherever I go. Well, I already bring my devices wherever I go.

Why this and not X service?

The tools available at the command line can work even in the absence of internet connectivity and take literally no time to open up. I also trust the text files will still be readable for decades to come even when businesses come and go.

The online part of my workflow (powered by git) is not necessary, only nice, as it allows every device to keep in sync by pulling the latest from the remote.

Could it be made even simpler?

Maybe the process can be further streamlined with an automation for the second step (the saving and pushing step with 'gcj'), which might be worth looking into for even less friction.

I'd just like to not pollute my git log too much. Maybe an optimization would be to check the latest commit, and if it is for the same journal entry, amend that commit and force-push instead of making a whole new commit.


After writing this article, I created an additional jy alias to access yesterday's entry. It works by passing and additional -d parameter to the date coreutils command.

alias jy='( cd ~/ \
    && vim journal/$(date -I -dyesterday).md )'