box.matto.nl

home/

Keeping a minimalist logbook in Vim

Last edited

The combination of the Ratpoision windowmanager and Vim makes it possible to keep a minimalist logbook in Vim in a very easy way.

Vim logbook plugin

I installed the logbook plugin from James Routley. This plugin can be found on Github:

https://github.com/jamesroutley/vim-logbook

To make things easier, and to adopt some personal changes, I have made a fork on this server, that can be reached through:

git clone git://box.matto.nl/git/logbook.git

The changes toward the orginal are:

  • Add function to create headerline for the file per day
  • Added poundsigns, so that the headerline is a level 1 header and the timestamp is a level 2 header.
  • Moved the logbook from ~/logbook to ~/.logbook, so it does not clutter ls in my $HOME

Entry in .ratpoisonrc

I added this entry in my .ratpoisonrc file:

bind L exec st -e vim ~/.logbook/$(date '+%Y-%m-%d').md

Explanation:

  • bind L : [Ratpoison-Esc]-L will start the command that follows after "exec"
  • st : I use the st terminal emulator from suckless.org. You can also use xterm here
  • vim ~/.logbook/$(date '+%Y-%m-%d').md : open the logbook-file with the current date

If the file does not exsist, Vim will create it.

Example of the logbook files

# Log for Saturday 2018-10-27

## Sat 27 Oct 2018 09:33:29 AM CEST
- Updated OpenBSD on Beaglebone Black board
- Mowed the lawn
- You get the point

## Sat 27 Oct 2018 09:37:39 AM CEST
- Fed the cat
- Washed the bicycle

Of course, you could also use free text instead of a list of items.

Workflow

Hit the ratpoison-escape key followed by shift-l ( L ) to start vim on a file with a name like ~/.logbook/2018-10-27.md, in a new terminal window.

If this file is empty (first time use for this specific day), add a level 1 header with the command:

:Hs

At a level 2 header with current timestamp, with command:

:Ts

Type your logentry beneath it.

:wq to save the file.

Add the new changes to a git repository:

git add -A; git commit -m '<some message>'; git push

I commit to git, to ensure there is a copy of the log on anohter system, and also to distribute the logfile to several laptops (a laptop for daytime job work related stuff, and a private laptop.at home for home related stuff, and another private laptop -- yes, I use to many laptops).

At the beginning of the day, I start with a git pull, in order to get the most recent changes. As I only work at one laptop at a time, I only have to this after booting up.

Easypeasy and very useful !