Keeping a logbook with vim

There’s a lot to be said for embracing basic tools for getting stuff done. Keeping track of notes is a great example of where some basic tooling can achieve the same result as paid services.

My setup

  1. Vim, some aliases and templates
  2. Dropbox, for sync
  3. Grep, for search

File Structure

I keep a single file for each day of the year, using the date format: YYYY-MM-DD. This makes search easy. Terminal completions in zsh shell work well with this format.

1
2
➜  vim ~/logbook/2019-03-2
2019-03-20.md  2019-03-21.md

All files are formatted in markdown and I use the vim-markdown plugin for syntax and section collapsing.

File Content

I find it increasingly useful to use checklists to manage my work. This ensures I don’t have to manage the cognitive load of remembering things.

I start the day with a simple checklist:

1
2
3
4
5
# start
I will focus on:
*
*
*

It’s a simple 3 point list of what’s important to focus on. If I start doing something that’s not on the list, then it helps me to check myself and ensure I am doing valuable work. Also if something more important comes up, it becomes a conscious decision to drop something from the list and replace it.

I have the equivalent checklist for the end of the day:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# end
[ ] Reply to / schedule anything urgent. gmail, slack.
[ ] Transfer mental tasks and notes to clubhouse / trello.
[ ] Skim over tasks and check next calendar days.
[ ] Create a rough plan for tomorrow.


# end complete
What are you doing to unwind tonight?
*

It’s important to capture the information, and context that you have at the end of the day before you go home. This makes picking back up in the morning much easier

For all other information I create sensble headers for the sections and then just write.. sometimes freeform, often bullets.

1
2
3
4
5
6
# Important thing title

The important thing is happening and to do it we will need to consider:
- important sub thing 1
- important sub thing 2
- etc

Keeping everything for one day in one file makes it much easier to see what I acheived and worked on in that day. Markdown plaintext makes searching very easy with:

1
2
3
4
➜  grep -rni "important thing"
/home/zak/logbook/2019-03-22.md:58:# Important thing title
/home/zak/logbook/2019-03-22.md:61:- important sub thing 1
/home/zak/logbook/2019-03-22.md:62:- important sub thing 2

Aliases

To reduce the overhead and automate the tasks that I do most when interacting with the logbook files I’ve created a series of zsh aliases.

Create a new logbook entry:

1
2
3
4
5
6
7
function lb() {
	x="0"
	if [[ ! -z "$1" ]]; then
		x=$1
	fi
	$EDITOR ~/logbook/$(date -d "$x days" '+%Y-%m-%d').md
}

Usage:

1
2
3
➜  lb    # today's entry
➜  lb +1 # tomorrow's entry
➜  lb +7 # next week's entry

Breaking this down, it uses the $EDITOR env var (set to vim) to create a new logbook entry in the dir ~/logbook/.

The offset passed is in days, allowing easy access to yesterday’s and tomorrow’s notes.

Templates:

I have some alises for inserting the checklists into logbook files. All aliase templates are stored in ~/.vim/templates.

1
2
3
4
5
6
7
function lbstart() {
	$EDITOR +'r ~/.vim/templates/start.md' ~/logbook/$(date '+%Y-%m-%d').md
}

function lbend() {
	$EDITOR +'normal Go' +'r ~/.vim/templates/end.md' ~/logbook/$(date '+%Y-%m-%d').md
}

Sync

There are many ways to sync the files, they are just plaintext files. For a while I tried storing them in git, but the overhead of needing to commit changes was a little too high.

Instead the ideal sync system just runs in the background and syncs across devices and backs up logbook entries.

I am currently using Dropbox to sync the files. It has good cross device support and “just works”.

I symlink /home/zak/logbook -> /home/zak/Dropbox/logbook so that dropbox can handle all it’s stuff and logbook can have a nice top level dir.

5 months on…

1
2
➜  ls -l ~/logbook/ | wc -l
117

So far there are 117 entries, which when accounting for weekends is roughly 5months.

It’s going very well, and the tooling reduces the amount of effort requried.